From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0002.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0002.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0002.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0002.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0002.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0002.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0002.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0002.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0002.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0002.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0002.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0002.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0002.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0002.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0002.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0002.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0002.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0002.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0002.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0002.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0002.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0002.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0002.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0002.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0002.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0002.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0002.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0002.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0002.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0002.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0002.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0002.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0002.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0002.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0002.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0002.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0003.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0003.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0003.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0003.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0003.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0003.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0003.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0003.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0003.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0003.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0003.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0003.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0003.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0003.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0003.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0003.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0003.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0003.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0003.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0003.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0003.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0003.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0003.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0003.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0003.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0003.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0003.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0003.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0003.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0003.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0004.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0003.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0003.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0003.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0003.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0003.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0004.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0004.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0004.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0004.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0004.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0004.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0004.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0004.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0004.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0004.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0004.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0004.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0004.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0004.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0004.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0004.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0004.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0004.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0004.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0004.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0004.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0004.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0004.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0004.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0004.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0004.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0004.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0004.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0004.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0004.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0005.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0004.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0004.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0004.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0004.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0004.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0005.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0005.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0005.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0005.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0005.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0005.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0005.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0005.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0005.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0005.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0005.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0005.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0005.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0005.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0005.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0005.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0005.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0005.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0005.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0005.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0005.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0005.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0005.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0005.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0005.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0005.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0005.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0005.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0005.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0005.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0006.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0005.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0005.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0005.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0005.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0005.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0006.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0006.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0006.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0006.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0006.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0006.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0006.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0006.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0006.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0006.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0006.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0006.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0006.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0006.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0006.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0006.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0006.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0006.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0006.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0006.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0006.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0006.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0006.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0006.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0006.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0006.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0006.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0006.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0006.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0006.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0007.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0006.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0006.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0006.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0006.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0006.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0007.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0007.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0007.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0007.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0007.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0007.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0007.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0007.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0007.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0007.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0007.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0007.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0007.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0007.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0007.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0007.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0007.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0007.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0007.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0007.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0007.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0007.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0007.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0007.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0007.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0007.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0007.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0007.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0007.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0007.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0003.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0007.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0007.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0007.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0007.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0007.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0008.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0008.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0008.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/d2be9f40/attachment-0008.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0008.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/9e2c3835/ParallelPort-WiringDiagram-0008.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/ecd052fe/attachment-0008.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0008.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0008.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0008.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0008.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0008.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0008.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0008.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0008.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0008.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0008.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0008.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0008.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0008.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0008.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/264f6c24/attachment-0008.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0008.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0008.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0008.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0008.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0008.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0008.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f8cbc57c/attachment-0008.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0008.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0008.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0008.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0008.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0008.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0008.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0008.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0009.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0009.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0009.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/d2be9f40/attachment.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0009.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/9e2c3835/ParallelPort-WiringDiagram.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/ecd052fe/attachment.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0009.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0009.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0009.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0009.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0009.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0009.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0009.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0009.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0009.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0009.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0009.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0009.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0009.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0009.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/264f6c24/attachment.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0009.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0009.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0009.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0009.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0009.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0009.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060321/f8cbc57c/attachment.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0009.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0009.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0009.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0009.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0009.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0009.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0009.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0010.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0010.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0010.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/d2be9f40/attachment-0001.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0010.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/9e2c3835/ParallelPort-WiringDiagram-0001.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/ecd052fe/attachment-0001.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0010.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0010.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0010.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0010.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0010.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0010.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0010.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0010.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0010.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0010.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0010.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0010.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0010.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0010.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/264f6c24/attachment-0001.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0010.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0010.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0010.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0010.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0010.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0010.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dmitry Markman wrote: > it's in the commapi-0-0-1 branch > > I tested it right now: > cvs co -r commapi-0-0-1 rxtx-devel > > and I got everything > A fresh checkout worked. Here is a copy of the tree (just the installer bits) ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 08:08:26 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 10:08:26 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi All, Is the Auth package able to work properly on non Mac OS's? It was not clear from the doc or download. Thanks! - Doug From dmarkman at mac.com Mon Mar 20 08:15:22 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 10:15:22 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <217312D8-CCCA-4859-ABA6-32DF1CC817B9@mac.com> thanks Trent, for putting it on ftp server On Mar 20, 2006, at 9:52 AM, Trent Jarvi wrote: > A fresh checkout worked. Here is a copy of the tree (just the > installer bits) > > ftp://ftp.qbang.org/pub/rxtx/MacOSX-installer.zip > Dmitry Markman From dmarkman at mac.com Mon Mar 20 09:14:03 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 11:14:03 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <4DEBA6F0-DA45-4E84-823E-1F1AC48BDCCC@mac.com> no it will work only on mac os x however it's harmless to run it on other platform if you want to use it for other platform you have to do the following (I'll do it for linux) 1. modify RXTXInstaller class method public static RXTXInstaller getInstance() public static RXTXInstaller getInstance() { String osName = System.getProperty("os.name").toLowerCase(); if(osName.startsWith("mac")){ return new gnu.io.installer.macosx.MACOSXRXTXInstaller(); } else if(osName.startsWith("windows")){ return new gnu.io.installer.windows.WindowsRXTXInstaller(); }else if(osName.startsWith("linux")){ return new gnu.io.installer.linux.LinuxRXTXInstaller(); } return null; } 2. create folder gnu/io/installer/linux/ 3. create class Linux386RXTXInstaller package gnu.io.installer.linux; import java.io.File; public class Linux386RXTXInstaller extends gnu.io.installer.RXTXInstaller{ public Linux386RXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ linux/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/linux/lib/librxtxSerial.so"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } 4. create folder /gnu/io/installer/resources/linux/jar and put there linux's version of RXTXcomm.dat (which is renamed RXTXcomm.jar) 5. create folder /gnu/io/installer/resources/linux/lib and put there linux's version of librxtxSerial. so 6. make sure that RXTXInstaller.jar has the following items: /gnu/io/installer/resources/linux/jar/RXTXcomm.jar /gnu/io/installer/resources/linux/lib/librxtxSerial.so 7. modify file installer.pref: jar file RXTXInstaller.jar must have the following item /gnu/io/installer/installer.pref that's basically it for windows you have to do the similar things: just replace linux to windows and librxtxSerial.so to rxtxSerial.dll and create appropriate gnu.io.installer.windows.WindowsRXTXInstaller class package gnu.io.installer.windows; import java.io.File; public class WindowsRXTXInstaller extends gnu.io.installer.RXTXInstaller{ public WindowsRXTXInstaller(){ createJarFolder(); createLibFolder(); addJarResource("RXTXcomm.jar","/gnu/io/installer/resources/ windows/jar/RXTXcomm.dat"); addLibResource("librxtxSerial.so","/gnu/io/installer/ resources/windows/lib/rxtxSerial.dll"); } protected void createJarFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; jarFolder = new File(javaHome+separator+"lib"+separator+"ext"); } protected void createLibFolder(){ String javaHome = System.getProperty("java.home"); char separator = File.separatorChar; libFolder = new File(javaHome+separator+"bin"); } public void runPreProcess() {} //put here some action you need public void runPostProcess() {} //put here some action you need } installer.pref will look like On Mar 20, 2006, at 10:08 AM, Dr. Douglas Lyon wrote: > Hi All, > Is the Auth package able to work properly on > non Mac OS's? > It was not clear from the doc or download. > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From joachim at buechse.de Mon Mar 20 10:49:06 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 18:49:06 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails Message-ID: This was only tested on MacOSX but looking at the code, it should be true for all systems that use lock_uucp. I am opening a port which can not be opened (dialup port of a telephone paired via bluetooth but currently not reachable). The lock file is created and stays arround, even though the port open failed. After looking a bit through the code (of 2.17), I really wonder if it wouldn't be a good idea to make the "locking" an explicit operation called from the java code. This would certainly simplify the generation of meaningfull exceptions (and java based debugging). Maybe even the handling of "preopened" ports should be in the Java part of the lib (again for java based debugging puposes). That beeing said, I have no idea if this would be possible for the 2.07 implementation. Regards, Joachim From tjarvi at qbang.org Mon Mar 20 11:24:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 11:24:22 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > This was only tested on MacOSX but looking at the code, it should be true > for all systems that use lock_uucp. > > I am opening a port which can not be opened (dialup port of a telephone > paired via bluetooth but currently not reachable). The lock file is > created and stays arround, even though the port open failed. > > > After looking a bit through the code (of 2.17), I really wonder if it > wouldn't be a good idea to make the "locking" an explicit operation > called from the java code. This would certainly simplify the generation > of meaningfull exceptions (and java based debugging). > Maybe even the handling of "preopened" ports should be in the Java part > of the lib (again for java based debugging puposes). That beeing said, I > have no idea if this would be possible for the 2.07 implementation. > > Regards, Hi Joachim It should be possible in the 2.0-7 implementation too. The calls to RXTXPort.java would not change. We would just do more there Moving more of that logic into Java would be better as many people don't like to look at C code. There is a liblockdev on most Linux distros that can do most of the C code and would be easier to use. The problem is embeded devices will not have that library. The preopened port code has not been really tested. That was a last minute request in a product cycle. I expect it will be tested this year though. As I recall, some devices really do not like CD raising on open. The preopened ports then allow people to mess around in java without power cycling the devices or losing data. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:01:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:01:08 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: Hi Trent, What is your general feeling about moving code to Java? The last days I have been reading quite a bit of the code and there are several things, that might not work as expected. I'll give you two examples from is_device_locked: if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be checked. LOCKDIR is not checked for lockfiles with unexpected pefixes While these things have probably never been discovered in production, they are still possibly incorrect implementations. If it was Java code, I would write some unit tests producing the errors that could later be corrected. PS: One could imagine to actually implement the whole lockfile handling in Java using some native routines to get the values required (pid, st_dev, st_rdev, ...). On 20.03.2006, at 19:24, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> This was only tested on MacOSX but looking at the code, it should >> be true for all systems that use lock_uucp. >> >> I am opening a port which can not be opened (dialup port of a >> telephone paired via bluetooth but currently not reachable). The >> lock file is created and stays arround, even though the port open >> failed. >> >> >> After looking a bit through the code (of 2.17), I really wonder if >> it wouldn't be a good idea to make the "locking" an explicit >> operation called from the java code. This would certainly simplify >> the generation of meaningfull exceptions (and java based debugging). >> Maybe even the handling of "preopened" ports should be in the Java >> part of the lib (again for java based debugging puposes). That >> beeing said, I have no idea if this would be possible for the 2.07 >> implementation. >> >> Regards, > > Hi Joachim > > It should be possible in the 2.0-7 implementation too. The calls > to RXTXPort.java would not change. We would just do more there > Moving more of that logic into Java would be better as many people > don't like to look at C code. There is a liblockdev on most Linux > distros that can do most of the C code and would be easier to use. > The problem is embeded devices will not have that library. > > The preopened port code has not been really tested. That was a > last minute request in a product cycle. I expect it will be tested > this year though. As I recall, some devices really do not like CD > raising on open. The preopened ports then allow people to mess > around in java without power cycling the devices or losing data. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:21:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:21:02 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Hi Trent, > > What is your general feeling about moving code to Java? The last days I > have been reading quite a bit of the code and there are several things, > that might not work as expected. > > I'll give you two examples from is_device_locked: > > if LOCKDIR == /var/spool/locks the directory /var/spool/lock will not be > checked. > LOCKDIR is not checked for lockfiles with unexpected pefixes > > While these things have probably never been discovered in production, > they are still possibly incorrect implementations. If it was Java code, I > would write some unit tests producing the errors that could later be > corrected. > > PS: One could imagine to actually implement the whole lockfile handling > in Java using some native routines to get the values required (pid, > st_dev, st_rdev, ...). Hi Joachim I like the idea of moving more of the code into java but there are some things to consider. If you break this into multiple JNI calls, the performance will drop considerably during enumeration of ports. We are looking for 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its hard to make assumptions. I've seen virtual ports start at /dev/foo100 for instance. It works out to over 7500 ports on Linux if you enable them all. We already trim that back by default. See Linux-all-ports in RXTXCommDriver.java. There are also native libraries that rxtx can link to. If you move too much into Java, linking to 'standard' libraries with distros will break. "configure --enable-liblock=yes" will not be doable. This is probably a favorable way with RedHat, Debian, Suse and others. Thats the right thing to do if there will be rpms, dpkg, .. For those reasons, I think it still make sense to keep it to a minimal ~3 calls to JNI code that we can use for speed and versatility. lock() isLocked(), unlock() perhaps. When I say speed, its more about avoiding crossing the JNI layer multiple times than java vs C performance. With versatility I think liblock is the right way for most but not all (embeded) linux distros. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Mon Mar 20 12:42:04 2006 From: joachim at buechse.de (Joachim Buechse) Date: Mon, 20 Mar 2006 20:42:04 +0100 Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: References: Message-ID: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Ok, what about providing a default implementation in Java? The RXTXCommDriver would call a (native) function useNativeLocking and if it returns true, call the native functions for lock() isLocked (), unlock(), else is would use the Java based default implementation. This could possibly be overriden by a property (again for debugging). Joachim On 20.03.2006, at 20:21, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Joachim Buechse wrote: > >> Hi Trent, >> >> What is your general feeling about moving code to Java? The last >> days I have been reading quite a bit of the code and there are >> several things, that might not work as expected. >> >> I'll give you two examples from is_device_locked: >> >> if LOCKDIR == /var/spool/locks the directory /var/spool/lock will >> not be checked. >> LOCKDIR is not checked for lockfiles with unexpected pefixes >> >> While these things have probably never been discovered in >> production, they are still possibly incorrect implementations. If >> it was Java code, I would write some unit tests producing the >> errors that could later be corrected. >> >> PS: One could imagine to actually implement the whole lockfile >> handling in Java using some native routines to get the values >> required (pid, st_dev, st_rdev, ...). > > Hi Joachim > > I like the idea of moving more of the code into java but there are > some things to consider. > > If you break this into multiple JNI calls, the performance will > drop considerably during enumeration of ports. We are looking for > 256 ports per dev type vs (16? in Sun's 2.0 and fewer types). Its > hard to make assumptions. I've seen virtual ports start at /dev/ > foo100 for instance. > > It works out to over 7500 ports on Linux if you enable them all. > We already trim that back by default. See Linux-all-ports in > RXTXCommDriver.java. > > There are also native libraries that rxtx can link to. If you move > too much into Java, linking to 'standard' libraries with distros > will break. "configure --enable-liblock=yes" will not be doable. > This is probably a favorable way with RedHat, Debian, Suse and > others. Thats the right thing to do if there will be rpms, dpkg, .. > > For those reasons, I think it still make sense to keep it to a > minimal ~3 calls to JNI code that we can use for speed and > versatility. lock() isLocked(), unlock() perhaps. When I say > speed, its more about avoiding crossing the JNI layer multiple > times than java vs C performance. With versatility I think liblock > is the right way for most but not all (embeded) linux distros. > > -- > Trent Jarvi > tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Mon Mar 20 12:44:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 12:44:47 -0700 (MST) Subject: [Rxtx] BUG: Lock file stays even if port opening fails In-Reply-To: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> References: <82C19FE7-DDCB-45B6-B2C9-7606B66F0124@buechse.de> Message-ID: On Mon, 20 Mar 2006, Joachim Buechse wrote: > Ok, what about providing a default implementation in Java? > > The RXTXCommDriver would call a (native) function useNativeLocking and if > it returns true, call the native functions for lock() isLocked(), > unlock(), else is would use the Java based default implementation. This > could possibly be overriden by a property (again for debugging). > Hi Joachim That would be OK with me. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 22:27:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 00:27:45 -0500 Subject: [Rxtx] binaries request Message-ID: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Hi can somebody send me latest linux and windows binaries, please? or where I can find them (I didn't find them in the latest tareball) I gave up with my cygwin: something wrong I have no idea what java doesn't understand /cygwin/c syntax after I changed makefile it did java part but after that gcc 3.4.4 started to complain I set buffer length to 999 lines but I didn't get beginning of the story something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it anyway I gave up thanks in advance Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060321/f8cbc57c/attachment-0001.html From tjarvi at qbang.org Mon Mar 20 22:36:48 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 22:36:48 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: <42702213-C222-4937-A585-7CFB17E47608@mac.com> References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > Hi > can somebody send me latest linux and windows binaries, please? > > or where I can find them (I didn't find them in the latest tareball) > > I gave up with my cygwin: something wrong I have no idea what > java doesn't understand /cygwin/c syntax > after I changed makefile it did java part > but after that gcc 3.4.4 started to complain > I set buffer length to 999 lines but I didn't get beginning of the story > something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it > anyway I gave up > > thanks in advance > Hi Dmitry The bins are here: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip Here are the files in the zip you want. Jar: rxtx-2.1-7-bins-r2/RXTXcomm.jar Windows: rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll Linux (x86) rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so There are others in there including Parallel port support but those are the main ones for testing. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 23:05:59 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 01:05:59 -0500 Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: thank you very much but windows's readme says: rxtxSerial.dll had to be recomopiled to link in missing native methods. should I ignore it? or what? thanks again also I understand that I should use mingw not cygwin I'll try to install mingw On Mar 21, 2006, at 12:36 AM, Trent Jarvi wrote: > On Tue, 21 Mar 2006, Dmitry Markman wrote: > >> Hi >> can somebody send me latest linux and windows binaries, please? >> >> or where I can find them (I didn't find them in the latest tareball) >> >> I gave up with my cygwin: something wrong I have no idea what >> java doesn't understand /cygwin/c syntax >> after I changed makefile it did java part >> but after that gcc 3.4.4 started to complain >> I set buffer length to 999 lines but I didn't get beginning of the >> story >> something wrong with my 1.4.2_09/include/jni.h gcc doesn't like it >> anyway I gave up >> >> thanks in advance >> > > Hi Dmitry > > The bins are here: > > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip > > Here are the files in the zip you want. > > Jar: > > rxtx-2.1-7-bins-r2/RXTXcomm.jar > > Windows: > > rxtx-2.1-7-bins-r2/Windows/i368-mingw32/rxtxSerial.dll > > Linux (x86) > > rxtx-2.1-7-bins-r2/Linux/i686-unknown-linux-gnu/librxtxSerial.so > > There are others in there including Parallel port support but those > are the main ones for testing. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 23:20:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 23:20:33 -0700 (MST) Subject: [Rxtx] binaries request In-Reply-To: References: <42702213-C222-4937-A585-7CFB17E47608@mac.com> Message-ID: On Tue, 21 Mar 2006, Dmitry Markman wrote: > thank you very much > > but windows's readme says: > rxtxSerial.dll had to be recomopiled to link in missing native methods. > > should I ignore it? or what? > Hi Dmitry That dll should be OK. r2 is the recompile linked to the missing native method. The readme explains why it was recompiled; fuser.o was not linked into the dll in the first release. -- Trent Jarvi tjarvi at qbang.org From ariantristan at yahoo.com Mon Mar 20 23:55:24 2006 From: ariantristan at yahoo.com (Lambok Sianturi) Date: Mon, 20 Mar 2006 22:55:24 -0800 (PST) Subject: [Rxtx] jvm issue Message-ID: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Hi All, This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 # # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) # Problematic frame: # C [ld-linux.so.2+0xa7f3] # # An error report file with more information is saved as hs_err_pid2633.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # ./run.sh: line 3: 2633 Aborted /usr/local/java/bin/java -Djava.library.path=/usr/local/java/jre/lib/ -Djsmsengine.debug=true -classpath jsmsengine.jar:smsgateway.jar:classes12.jar:RXTXcomm.jar:. com.api.sms.SMSServer What is the jvm depedency for the latest library? Can I use 1.4.2_09 b05? Thanks in advance. Arian --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/83d58dd7/attachment-0010.html From f.frumento at ngi.it Tue Mar 21 00:21:47 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Tue, 21 Mar 2006 08:21:47 +0100 Subject: [Rxtx] Javadoc on the go Message-ID: <441FA98B.9050701@ngi.it> Hi Trent, sorry for the big delay but my job is running wild, i was out for some time but now i'm back and ready to continue the javadoc for Rxtx. Did you used the last javadoc patch i sent you ? let me know if i have to send it to you again or not. regards Fabio From lyon at docjava.com Tue Mar 21 00:51:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Tue, 21 Mar 2006 02:51:18 -0500 Subject: [Rxtx] lock files Message-ID: Hi All, You know, if the use of lock files were under Java control (rather than a build-time decision), it might enable a more unified binary distro. It might also facilitate quick prototyping of non-lock file approaches to resolving serial port contention issues (i.e., mac-like approaches vs. linux approaches, etc.). I realize that this is a radical overhaul of the lock file policy issue. Also, it may harm performance. On the other hand, our benchmarks on JNI overhead for modern processors indicate performance impact should be minimal. Perhaps it is more of an issue with the toybox systems. Suppose there were a class with a reasonable default...someone might write: SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); Thus, we could have a run-time reconfiguration of the serial port lock policy. A special NO_LOCK version of the binary would no longer be required. Any thoughts on this? Thanks! - Doug From joachim at buechse.de Tue Mar 21 03:09:09 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 11:09:09 +0100 Subject: [Rxtx] lock files In-Reply-To: References: Message-ID: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> This is pretty much what I thought about when I suggested, that the default behaviour could be overwritten with a property. I am very much in favor of this approach. In particular this allows much easier debugging for PC based java developers. I think big parts of the Java (and maybe some parts of the C code) could use a bit of a structural workover (unit tests, javadoc, synchronization, etc). Maybe there should be a CVS branch for this experimental version. I'd be happy to contribute a first workover for some of the Java code. Designing for testability and implementing a good bunch of unit tests has been a strategy that worked quite well in the Java projects I lead. And it ultimately allows more liberal change permission. Regards, Joachim On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > Hi All, > You know, if the use of lock files were > under Java control (rather than a build-time decision), > it might enable a more unified binary distro. It might also > facilitate quick prototyping of non-lock file approaches > to resolving serial port contention issues (i.e., mac-like > approaches vs. linux approaches, etc.). > > I realize that this is a radical overhaul of the lock file policy > issue. Also, it may harm performance. On the other hand, > our benchmarks on JNI overhead for modern processors indicate > performance impact should be minimal. Perhaps it is more of > an issue with the toybox systems. > > Suppose there were a class with a reasonable default...someone > might write: > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); > SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); > > Thus, we could have a run-time reconfiguration of the serial port lock > policy. A special NO_LOCK version of the binary would no longer > be required. > > Any thoughts on this? > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From joachim at buechse.de Tue Mar 21 06:23:08 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 21 Mar 2006 14:23:08 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles Message-ID: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only for OSX 10.4.5, hence it is only defined for APPLE. However, it should work at least for Solaris as well. If a process has requested TIOEXCL further open calls by other user processes will fail. The patch also disables uucp style locking for APPLE. Obviously this is discussable. I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp). Regarding the possibility of root processes opening a device which is locked - I consider this a feature not a potential problem. It is highly unlikely, that somebody is crazy enough to run a JavaVM as root (unless he has no other means of getting a restricted IP port opened, ie doesnt understand ipfw). Anyway, even if the process runs as root, it fails when calling ioctl(fd, TIOCEXCL). It could however still open the port to listen for RING events. I.e. a fax server which needs to see incoming calls but otherwise doesnt want to block the port. So the only case where the proposed mechanism fails is, if an incorrectly implemented process running as root conflicts with a user process. I think this can be accepted. Regards, Joachim PS: If this patch is generally accepted, the installer and Mac doku should obviously be changed as well. Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 @@ -656,6 +656,25 @@ fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); } while (fd < 0 && errno==EINTR); +#ifdef OPEN_EXCL + // Note that open() follows POSIX semantics: multiple open() calls to + // the same file will succeed unless the TIOCEXCL ioctl is issued. + // This will prevent additional opens except by root-owned processes. + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. + + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) + { + sprintf( message, "open: exclusive access denied for % s\n", + filename ); + report( message ); + report_error( message ); + + close(fd); + goto fail; + } +#endif /* OPEN_EXCL */ + + if( configure_port( fd ) ) goto fail; (*env)->ReleaseStringUTFChars( env, jstr, filename ); sprintf( message, "open: fd returned is %i\n", fd ); Index: SerialImp.h =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v retrieving revision 1.11.2.49 diff -u -r1.11.2.49 SerialImp.h --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 @@ -135,7 +135,8 @@ /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." -# define UUCP +/*# define UUCP*/ +# define OPEN_EXCL #endif /* __APPLE__ */ #if defined(__NetBSD__) # define DEVICEDIR "/dev/" From tjarvi at qbang.org Tue Mar 21 10:26:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:26:08 -0700 (MST) Subject: [Rxtx] Javadoc on the go In-Reply-To: <441FA98B.9050701@ngi.it> References: <441FA98B.9050701@ngi.it> Message-ID: On Tue, 21 Mar 2006, Fabio Frumento wrote: > Hi Trent, > > sorry for the big delay but my job is running wild, i was out for some > time but now i'm back and ready to continue the javadoc for Rxtx. > > Did you used the last javadoc patch i sent you ? let me know if i have to > send it to you again or not. > > regards > > Fabio Hi Fabio The patch is in the rxtx mail-list archives. It will be going in soon. I did not see a time critical portion. I'll probably be going through the list since the last batch of patches this weekend and putting them into CVS. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 10:57:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 10:57:18 -0700 (MST) Subject: [Rxtx] jvm issue In-Reply-To: <20060321065524.94779.qmail@web50701.mail.yahoo.com> References: <20060321065524.94779.qmail@web50701.mail.yahoo.com> Message-ID: On Mon, 20 Mar 2006, Lambok Sianturi wrote: > Hi All, > This is my first time to join RxTx mailing list. I thank you all for allowing others to sign in in requests help. > I use the latest RxTx lib in Fedora 3 with java version 1.4.2_09 b05. And I got this error: > > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # SIGSEGV (0xb) at pc=0x00bf27f3, pid=2633, tid=3086112448 > # > # Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode) > # Problematic frame: > # C [ld-linux.so.2+0xa7f3] A native library loading error? What happens if you recompile rxtx on your system and install that? This sounds like an ABI problem? rxtx 2.1-7 was compiled with a gcc 2.96 toolchain as I recall. The hope is newer system will be backwards compatible. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:05:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:05:29 -0700 (MST) Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: On Tue, 21 Mar 2006, Joachim Buechse wrote: > Here is the patch for the ioctl(fd, TIOCEXCL). I have verified this only > for OSX 10.4.5, hence it is only defined for APPLE. However, it should > work at least for Solaris as well. > > If a process has requested TIOEXCL further open calls by other user > processes will fail. > > The patch also disables uucp style locking for APPLE. Obviously this is > discussable. I think it is the way to go, as it eliminates creating the > lock directory which doesnt exist on the standard installation and it > eliminates messing with the system group definitions (adding users to > group uucp). > > Regarding the possibility of root processes opening a device which is > locked - I consider this a feature not a potential problem. It is highly > unlikely, that somebody is crazy enough to run a JavaVM as root (unless > he has no other means of getting a restricted IP port opened, ie doesnt > understand ipfw). Anyway, even if the process runs as root, it fails when > calling ioctl(fd, TIOCEXCL). It could however still open the port to > listen for RING events. I.e. a fax server which needs to see incoming > calls but otherwise doesnt want to block the port. So the only case where > the proposed mechanism fails is, if an incorrectly implemented process > running as root conflicts with a user process. I think this can be > accepted. > > Regards, > Joachim > > PS: If this patch is generally accepted, the installer and Mac doku > should obviously be changed as well. > > > Index: SerialImp.c > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v > retrieving revision 1.46.2.187 > diff -u -r1.46.2.187 SerialImp.c > --- SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 > +++ SerialImp.c 21 Mar 2006 12:59:16 -0000 > @@ -656,6 +656,25 @@ > fd=OPEN (filename, O_RDWR | O_NOCTTY | O_NONBLOCK ); > } while (fd < 0 && errno==EINTR); > > +#ifdef OPEN_EXCL > + // Note that open() follows POSIX semantics: multiple open() > calls to > + // the same file will succeed unless the TIOCEXCL ioctl is > issued. > + // This will prevent additional opens except by root-owned > processes. > + // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for > details. > + > + if (fd >= 0 && (ioctl(fd, TIOCEXCL) == -1)) > + { > + sprintf( message, "open: exclusive access denied for % > s\n", > + filename ); > + report( message ); > + report_error( message ); > + > + close(fd); > + goto fail; > + } > +#endif /* OPEN_EXCL */ > + > + > if( configure_port( fd ) ) goto fail; > (*env)->ReleaseStringUTFChars( env, jstr, filename ); > sprintf( message, "open: fd returned is %i\n", fd ); > Index: SerialImp.h > =================================================================== > RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.h,v > retrieving revision 1.11.2.49 > diff -u -r1.11.2.49 SerialImp.h > --- SerialImp.h 5 Jul 2005 17:47:21 -0000 1.11.2.49 > +++ SerialImp.h 21 Mar 2006 12:59:17 -0000 > @@ -135,7 +135,8 @@ > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > -# define UUCP > +/*# define UUCP*/ > +# define OPEN_EXCL > #endif /* __APPLE__ */ > #if defined(__NetBSD__) > # define DEVICEDIR "/dev/" > This looks like a good start. What do you think Dmitry? Perhaps all systems with TIOCEXCL defined should use that though. Even if they use lockfiles. It wont hurt anything. That would catch people hacking their own serial apps without checking lockfiles. Its a good idea to avoid C++ style comments in the C portions. Some older systems don't deal with them well. If it's just for Mac OS X, it isn't a big deal. I think it was the Irix compiler that was problematic? -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 21 11:22:05 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 21 Mar 2006 11:22:05 -0700 (MST) Subject: [Rxtx] lock files In-Reply-To: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> References: <8E12916A-1B9A-4FF2-B684-E2D1C794221B@buechse.de> Message-ID: We can try it. Maybe the JNI is much improved. The nice thing about linking into liblock is distros then worry about lockfiles on their systems. This way, we have to deal with any changes that may show up. On Tue, 21 Mar 2006, Joachim Buechse wrote: > This is pretty much what I thought about when I suggested, that the > default behaviour could be overwritten with a property. I am very much in > favor of this approach. In particular this allows much easier debugging > for PC based java developers. > > I think big parts of the Java (and maybe some parts of the C code) could > use a bit of a structural workover (unit tests, javadoc, synchronization, > etc). Maybe there should be a CVS branch for this experimental version. > I'd be happy to contribute a first workover for some of the Java code. > Designing for testability and implementing a good bunch of unit tests has > been a strategy that worked quite well in the Java projects I lead. And > it ultimately allows more liberal change permission. > > Regards, > Joachim > > > On 21.03.2006, at 08:51, Dr. Douglas Lyon wrote: > >> Hi All, >> You know, if the use of lock files were >> under Java control (rather than a build-time decision), >> it might enable a more unified binary distro. It might also >> facilitate quick prototyping of non-lock file approaches >> to resolving serial port contention issues (i.e., mac-like >> approaches vs. linux approaches, etc.). >> >> I realize that this is a radical overhaul of the lock file policy >> issue. Also, it may harm performance. On the other hand, >> our benchmarks on JNI overhead for modern processors indicate >> performance impact should be minimal. Perhaps it is more of >> an issue with the toybox systems. >> >> Suppose there were a class with a reasonable default...someone >> might write: >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.UNIX_LOCK_FILE); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.NO_LOCK_CHECKING); >> SerialPortLockPolicy.setPolicy(SerialPortLockPolicy.MAC_STYLE); >> >> Thus, we could have a run-time reconfiguration of the serial port lock >> policy. A special NO_LOCK version of the binary would no longer >> be required. >> >> Any thoughts on this? >> >> Thanks! >> - Doug >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From dmarkman at mac.com Tue Mar 21 16:05:17 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:05:17 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <512AC70C-BB86-48F2-A83C-023F35C23BAB@mac.com> I think it's cool, but I'd like to have that property implementation when user can choose between locking mechanism about comments: it's easy to change comments to the C style or we can use extensions of the file to cpp so c++ compiler will be used On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. > > Its a good idea to avoid C++ style comments in the C portions. > Some older systems don't deal with them well. If it's just for Mac > OS X, it isn't a big deal. I think it was the Irix compiler that > was problematic? Dmitry Markman From dmarkman at mac.com Tue Mar 21 16:13:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Tue, 21 Mar 2006 18:13:00 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: I'd like to add that creating locking folder isn't a big deal we never had a problem related to the lock folders, because we always used installer on mac os x from other hand I'm not very much familiar with iotcl locking approach and I'm not sure it's more efficient Joachim wrote "I think it is the way to go, as it eliminates creating the lock directory which doesnt exist on the standard installation and it eliminates messing with the system group definitions (adding users to group uucp)." but I really didn't have any problem with that 1. doesn't exist on the standard installation there are many-many things that don't exist in the standard installation so I don't think that argument is strong enough 2. messing with the system group definitions I don't think we're messing with the group definition mac os x provides very clear way to set up group's members and together with Greg Guerin AuthKit there is no problem to set those definitions so I don't think that argument is strong either but from other hand using iotcl is more promising and is more elegant On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > > This looks like a good start. What do you think Dmitry? Perhaps > all systems with TIOCEXCL defined should use that though. Even if > they use lockfiles. It wont hurt anything. That would catch > people hacking their own serial apps without checking lockfiles. Dmitry Markman From joachim at buechse.de Wed Mar 22 04:46:45 2006 From: joachim at buechse.de (Joachim Buechse) Date: Wed, 22 Mar 2006 12:46:45 +0100 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: Sorry, I was not very clear with my arguments, so I will try again;-) Please, don't take this as an attack against work that has been done. I think the contributions that have been made in the past were made in a good spirit. But I really believe, that the current solution for OSX has many shortcomings and should be changed as soon as possible. lock files --- The /var/lock folder does not exist on the standard OSX installation, however the standard installation includes several applications that use serial ports (i.e. the FAX capability). This indicates, that the lock folder approach will not work well with system components. Applications for OSX will generally try to live in harmony with system components (except for HP print drivers of course). I think RXTX should follow this approach as well. uucp group --- Accessing serial ports is not an admin privileged operation on OSX. Any user (world) has read/write privileges on /dev/tty*. So the system default is to not enforce any group membership to access these ports. The group uucp however is a system group on all unix systems I know. It exists for certain system processes. A non admin user should in general not be a member of this group. Quite arguably no user should ever be a member of this group. Installer --- My general opinion is, that - no Installer should touch user or group data without warning - no Application Installer should touch groups which are not specific to the very application installed - no Installer should ever add regular users to a system group The current installer injects the installing user in the group uucp without warning about this change and without giving the option to "opt out" of this change. This is a potential security risk (but not currently a real one, as OSX contains no folders belonging to group uucp). The current installer does not work for multi user systems. It puts the installing user in the uucp group. However the installing user is not necessarily the user that will use the application. Putting all users that may use a serial port application in the system group uucp seems like a very invasive approach to me. Besides that, newly created users will not automatically be in the group and hence, serial applications will "break" for new users without obvious reasons. Avoiding the lock files will allow self contained applications (i.e. drag&drop installation). In my eyes this is largely preferable over an installer that requests admin privileges. Adding up all these points indicates very strongly, that the lock-file implementation is not the way to go on OSX. Regards, Joachim On 22.03.2006, at 00:13, Dmitry Markman wrote: > I'd like to add that > > creating locking folder isn't a big deal > we never had a problem related to the lock folders, because we > always used installer on mac os x > from other hand I'm not very much familiar with iotcl locking > approach and I'm not sure it's more efficient > > Joachim wrote "I think it is the way to go, as it eliminates > creating the lock directory which doesnt exist on the standard > installation and it eliminates messing with the system group > definitions (adding users to group uucp)." but I really didn't have > any problem with that > > 1. doesn't exist on the standard installation > there are many-many things that don't exist in the standard > installation so I don't think that argument is strong enough > 2. messing with the system group definitions > I don't think we're messing with the group definition > mac os x provides very clear way to set up group's members and > together with Greg Guerin AuthKit there is no problem to set those > definitions > so I don't think that argument is strong either > but from other hand using iotcl is more promising and is more elegant > > > > On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: > >> >> This looks like a good start. What do you think Dmitry? Perhaps >> all systems with TIOCEXCL defined should use that though. Even if >> they use lockfiles. It wont hurt anything. That would catch >> people hacking their own serial apps without checking lockfiles. > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Wed Mar 22 05:27:13 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 07:27:13 -0500 Subject: [Rxtx] PATCH: use of ioctl(fd, TIOCEXCL) instead of lockfiles In-Reply-To: References: <923AE774-EEA2-4911-92D8-32BB27802C8B@buechse.de> Message-ID: <83440CF3-DCD8-41C1-B941-F227232C27E3@mac.com> thanks for the very good explanation I didn't think that you were attacking any thing, so don't worry I just had feeling, that there were more aesthetic reasons for going to ioctl then real necessity now you explained everything quite well (BTW, asfar as I remember installer asks admin password so it wasn't quiet, but it really doesn't matter now) thanks On Mar 22, 2006, at 6:46 AM, Joachim Buechse wrote: > Sorry, I was not very clear with my arguments, so I will try again;-) > > Please, don't take this as an attack against work that has been > done. I think the contributions that have been made in the past > were made in a good spirit. But I really believe, that the current > solution for OSX has many shortcomings and should be changed as > soon as possible. > > lock files > --- > The /var/lock folder does not exist on the standard OSX > installation, however the standard installation includes several > applications that use serial ports (i.e. the FAX capability). This > indicates, that the lock folder approach will not work well with > system components. Applications for OSX will generally try to live > in harmony with system components (except for HP print drivers of > course). I think RXTX should follow this approach as well. > > uucp group > --- > Accessing serial ports is not an admin privileged operation on OSX. > Any user (world) has read/write privileges on /dev/tty*. So the > system default is to not enforce any group membership to access > these ports. The group uucp however is a system group on all unix > systems I know. It exists for certain system processes. A non admin > user should in general not be a member of this group. Quite > arguably no user should ever be a member of this group. > > Installer > --- > My general opinion is, that > - no Installer should touch user or group data without warning > - no Application Installer should touch groups which are not > specific to the very application installed > - no Installer should ever add regular users to a system group > > The current installer injects the installing user in the group uucp > without warning about this change and without giving the option to > "opt out" of this change. This is a potential security risk (but > not currently a real one, as OSX contains no folders belonging to > group uucp). > > The current installer does not work for multi user systems. It puts > the installing user in the uucp group. However the installing user > is not necessarily the user that will use the application. Putting > all users that may use a serial port application in the system > group uucp seems like a very invasive approach to me. Besides that, > newly created users will not automatically be in the group and > hence, serial applications will "break" for new users without > obvious reasons. > > > Avoiding the lock files will allow self contained applications > (i.e. drag&drop installation). In my eyes this is largely > preferable over an installer that requests admin privileges. Adding > up all these points indicates very strongly, that the lock-file > implementation is not the way to go on OSX. > > Regards, > Joachim > > > On 22.03.2006, at 00:13, Dmitry Markman wrote: > >> I'd like to add that >> >> creating locking folder isn't a big deal >> we never had a problem related to the lock folders, because we >> always used installer on mac os x >> from other hand I'm not very much familiar with iotcl locking >> approach and I'm not sure it's more efficient >> >> Joachim wrote "I think it is the way to go, as it eliminates >> creating the lock directory which doesnt exist on the standard >> installation and it eliminates messing with the system group >> definitions (adding users to group uucp)." but I really didn't >> have any problem with that >> >> 1. doesn't exist on the standard installation >> there are many-many things that don't exist in the standard >> installation so I don't think that argument is strong enough >> 2. messing with the system group definitions >> I don't think we're messing with the group definition >> mac os x provides very clear way to set up group's members and >> together with Greg Guerin AuthKit there is no problem to set those >> definitions >> so I don't think that argument is strong either >> but from other hand using iotcl is more promising and is more elegant >> >> >> >> On Mar 21, 2006, at 1:05 PM, Trent Jarvi wrote: >> >>> >>> This looks like a good start. What do you think Dmitry? Perhaps >>> all systems with TIOCEXCL defined should use that though. Even >>> if they use lockfiles. It wont hurt anything. That would catch >>> people hacking their own serial apps without checking lockfiles. >> >> Dmitry Markman >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From lyon at docjava.com Wed Mar 22 06:12:18 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 08:12:18 -0500 Subject: [Rxtx] sole of a new design pattern Message-ID: Hi All, I have been thinking about how we design the serial port software. I think we need a new design pattern. For lack of a better term, I shall call it: The Parametric Singleton Design Pattern By Douglas A. Lyon ABSTRACT The goal of the singleton design pattern is to make sure that there is one, and only one, instance of a given class. The goal of the parametric singleton design pattern is to make sure that there is one, and only one, instance of a given class with the given parametric values. We parametric singleton design pattern combines the singleton design pattern with a parameter that enables unique creation of instances of a class. These instances are cached. When a user asks for an instance with these parameters, the cache is checked. If the instance is in the cache, the instance is returned, otherwise it is created, added to the cache and then returned. We apply our parametric singleton design pattern to the retrieval of RMI registries bound to a given port. The goal of our system is to make sure that no two RMI registries are listening to the same socket and to make use of the RMI registries after they have been created. RMI registries are used in distributed computation. Introduction The singleton design pattern is meant to ensure that on a single instance of a class exists. It is also meant to provide a global point of access to it. The intent of the parametric singleton design pattern is to ensure that a class has only one instance for a given set of parameter values. It also provides a global point of access to it. Motivation A system cannot tolerate multiple instances of some classes with identical parameters. For example, you cannot have two instances making use of the same serial port, at the same time. You cannot have two instances that are trying to listen to the same socket connection. You cannot have two instances writing to the same file structure at the same time. As the operating system is often thought of as the arbiter of consumed resources (i.e., tape drives, serial ports, etc.) we frequently leave it to an operating system implementation to resolve these contention issues. Even for similar resources (like serial ports) there are few standards for handling contention. For example, serial ports on Linux are locked using a "/var/lock" file. POSIX, on the other hand, uses ioctl mechanisms to prevent contention. A better solution is to make a class that is responsible for keeping track of the instances created from the class. The class is declared final, so that it cannot be subclassed. The class also has a private constructor, so that other classes cannot instance it. The new design pattern is called the parametric singleton design pattern and it provides a way to access and create instances with given parameters. Applicability Use the Parametric Singleton Design Pattern when: 1. There must be exactly one instance of a class with the given parameters. 2. The instances must be accessible to clients from a well-known access point. Structure Insert UML diagram here. Participants The Parametric Singleton Clients that need instances 1. The Parametric Singleton defines an instance upon request from a client, if, and only if, the instance does not already exist. 2. The Parametric Singleton returns the instance to the client. 3. The Parametric Singleton is responsible for creating unique instances from given parameters. Collaborations Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. Further, it is not the role of the Parametric Singleton Design Pattern to check out resources. That is, multiple threads can have multiple references to the same resource at the same time. MUTEX locking is delegated to some other part of the system. Consequences The Parametric Singleton Design Pattern has several benefits: 1. Controlled access to parametrically defined instances. Since the Parametric Singleton class encapsulates its instances, there is control over how and when clients access it. 2. Reduced name space. The Parametric Singleton pattern avoids global variables that store instances created from the same parameter. Implementation Here are implementation issues to consider when using the Parametric Singleton pattern: 1. Unique mapping of parameters. The Parametric Singleton pattern requires that there be a mean to isomorphically map the parameter space into the instance space and back again. 2. Ensure unique instances. The Parametric Singleton pattern makes unique instances from parameters, and it does so only once. 3. Cache instances for fast retrieval. The Parametric Singleton pattern must be able to look up instances, given some set of parameters, and do so from some data structure. That is, there must be enough space to hold references to all the instances the program will need. Also, a mechanism is needed to look up and retrieve the instances quickly enough to satisfy the clients. Sample Code public final class ParametricSingletonRmiRegistry { private static Hashtable registry = new Hashtable(100); // use singleton pattern and??????????????????????????????????????????????? // prevent instantiation of RmiRegistryUtils.?????????????????????????????? private ParametricSingletonRmiRegistry() { } // the only instance of the Registry held by the RmiRegistryUtils?????????? public static void listNames(Integer port) { if (!isInCacheAndRunning(port)) return; Registry r = (Registry) registry.get(port); System.out.println("registry on port: " + port); System.out.println("registry: " + r); System.out.println("names: "); try { print(r.list()); } catch (RemoteException e) { In.message(e); } System.out.println("------------------------"); } /**???????????????????????????????????????????????????????????????????????? * Checks whether a Registry has been started on this host????????????????? * in the specified port.?????????????????????????????????????????????????? * If not, it tries to start one.?????????????????????????????????????????? * when it fails to start a Registry, it exits the program????????????????? * with exit code 1.??????????????????????????????????????????????????????? */ public static void restart(int port) { if (isInCacheAndRunning(port)) return; try { startRegistry(port); } catch (RemoteException e) { In.message(e); } } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if registry is in cache and running???????????????????????? */ private static boolean isInCacheAndRunning(Integer port) { if (!isRegistryRunning(port.intValue())) return false; if (!isRegistryInCache(port.intValue())) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return true if we are able to locate a local registry on port.??????????????????????????????????????????????????????????????????????????? */ private static boolean isRegistryRunning(int port) { try { Registry r = LocateRegistry.getRegistry(port); if (r != null) return true; } catch (RemoteException e) { return false; } return false; } /**???????????????????????????????????????????????????????????????????????? * @param port????????????????????????????????????????????????????????????? * @return return true if registry is in cache????????????????????????????? */ private static boolean isRegistryInCache(int port) { if (registry.get(new Integer(port)) == null) return false; return true; } /**???????????????????????????????????????????????????????????????????????? * Restart the registry, if needed.???????????????????????????????????????? * Return the only instance of the registry for consistent global?????????? * using by making use of the Singleton Design Pattern????????????????????? *????????????????????????????????????????????????????????????????????????? * @return the internally held registry instance.?????????????????????????? */ public static Registry getRegistry(Integer port) { restart(port); return (Registry) registry.get(port); } private static void startRegistry(Integer port) throws RemoteException { Registry r; try { r = LocateRegistry.createRegistry(port.intValue()); registry.put(port, r); //r = new sun.rmi.registry.RegistryImpl???????????????????????????? /// (port.intValue());?????????????????????????????????????? // registry.put(port, r);?????????????????????????????????????????? } catch (Exception e) { //e.printStackTrace();????????????????????????????????????????????? r = LocateRegistry.getRegistry(port.intValue()); registry.put(port, r); } } public static void main(String args[]) throws RemoteException { //restart(port);??????????????????????????????????????????????????????? restart(5001); restart(5002); restart(5002); Registry r = LocateRegistry.getRegistry(5002); System.out.println("registry="+r); } } I would very much like to get your feedback on this new design pattern idea. Thank you for your time. Regards, - Doug From david.garnier at trusted-logic.com Wed Mar 22 07:36:10 2006 From: david.garnier at trusted-logic.com (David Garnier) Date: Wed, 22 Mar 2006 15:36:10 +0100 Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: <442160DA.80107@trusted-logic.com> Hello, > The Parametric Singleton Design Pattern The Singleton is the most abused design pattern ever. Good use-cases for this pattern are extremely rare and mostly confined to problems related to hardware resources, like serial ports. > Applicability > > Use the Parametric Singleton Design Pattern when: > 1. There must be exactly one instance of a class with the given > parameters. OK. As I said above, this case this actually very unusual. The Singleton pattern is mostly used when : > 2. The instances must be accessible to clients from a well-known > access point. Using the singleton pattern in this case is just convenient for the programmer. Problems arises pretty quickly, especially if you attempt to unit-test your classes. 1) If your singleton is stateful, or hold on to stateful objects, it means that two different unit tests are not actually independent. Instead of starting with a brand new environment, the result of a test may be affected by the result of a previous test. This problem also arise when with your class relies on a database. In both cases, the solution is to reset your "unique" resource (Singleton or database) at the beginning of the test, which is a pain. Also, while most projects connect to a single database, projects that allow the use of Singletons usually contain several of thems, and new ones may cropped up unnoticed. You quickly end up with test cases that only pass in a certain order, which is a royal pain. 2) You cannot mockup a singleton. Once everyone calls the SomeSingleton class statically, you can't replace your class by SomeSingletonMockup. Furthermore, even for hardware services, the Singleton pattern does not really prevent concurrent accesses. If you start the same program in two different JVMs, unless they somehow shared the state of their "Singletons" (through lock files for example), the Singleton pattern will not prevent concurrent access. Our application uses RXTX, and we routinely encounter cases where another (native) application has already locked the port. Since we cannot modify the native application to recognize lock files, OS-level control is irreplaceable. > > Consequences > The Parametric Singleton Design Pattern has several benefits: > > 1. Controlled access to parametrically defined instances. Since > the Parametric Singleton class encapsulates its instances, there is > control over how and when clients access it. Not really. Once you've returned the instance to a client, you've lost control over it. The client can to whatever it wants with it. You cannot "recall" the instance or claim it back. > 2. Reduced name space. The Parametric Singleton pattern avoids > global variables that store instances created from the same parameter. Sure, but you don't have to rely on a Singleton for that. Just create a single Factory. > I would very much like to get your feedback on this new design > pattern idea. Well, it's nothing new. Some may say that it is the point of design patterns: formalizes the designs that occur again and again. However, this design is simply a combination of the Singleton and Factory patterns. I did use it in the past, but now I've been exposed to the shortcomings of the Singleton pattern, so I limit myself to Factories. Regards, David From sean_montgomery at baseview.com Wed Mar 22 08:35:28 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 22 Mar 2006 10:35:28 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: <05769CA7-A51B-4CF0-BAA0-E02DD905F5A4@baseview.com> On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Furthermore, even for hardware services, the Singleton pattern does > not really prevent concurrent > accesses. If you start the same program in two different JVMs, > unless they somehow shared the state > of their "Singletons" (through lock files for example), the > Singleton pattern will not prevent > concurrent access. > Multiple class loaders in a single JVM can be tricky, too. Then there's synchronization, lazy initialization and serialization of singletons to contend with. Bloch's Effective Java covers these, and here's a few articles: http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns- p3.html http://java.sun.com/developer/technicalArticles/Programming/singletons/ Just FYI :-) From lyon at docjava.com Wed Mar 22 08:50:48 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 22 Mar 2006 10:50:48 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: Hi All, First, I would like to thank David for his prompt and thoughtful remarks. I had no idea people that feel strongly about a design patterns! Wow! Feedback (particularly critical feedback) is greatly appreciated. Starting at the end, first: >I did use it in >the past, but now I've been exposed to the shortcomings of the >Singleton pattern, so I limit myself to Factories. David, if I understood your comments correctly, you suggested that Factories can be used in leu of the Singleton Design Pattern, or even the Parametric Singleton Design Pattern. As I see in [Gof]: Factory Method: Intent "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses." The Singleton Design Pattern is a concrete class, which is rather different, right? Also, subclasses are not permitted with Singleton, as they are final. Naturally, I could use an abstract factory as a parent for a singleton. I could even design a facade that could be implemented with the singleton....but that is not the intention of the design. Unless you want a mock-up, as discussed, below: More below: >Hello, > >> The Parametric Singleton Design Pattern > >The Singleton is the most abused design pattern ever. Good use-cases >for this pattern are extremely >rare and mostly confined to problems related to hardware resources, >like serial ports. > > >> Applicability >> >> Use the Parametric Singleton Design Pattern when: >> 1. There must be exactly one instance of a class with the given >> parameters. >OK. As I said above, this case this actually very unusual. The >Singleton pattern is mostly used when : >> 2. The instances must be accessible to clients from a well-known >> access point. > >Using the singleton pattern in this case is just convenient for the >programmer. Problems arises >pretty quickly, especially if you attempt to unit-test your classes. > >1) If your singleton is stateful, or hold on to stateful objects, it >means that two different unit >tests are not actually independent. Instead of starting with a brand >new environment, the result of >a test may be affected by the result of a previous test. This >problem also arise when with your >class relies on a database. In both cases, the solution is to reset >your "unique" resource >(Singleton or database) at the beginning of the test, which is a >pain. Also, while most projects >connect to a single database, projects that allow the use of >Singletons usually contain several of >thems, and new ones may cropped up unnoticed. You quickly end up >with test cases that only pass in a >certain order, which is a royal pain. There are basic problems with communicating finite state machines that include reachability and deadlock analysis. These are addressed with petri net analysis and are beyond the scope of the design pattern. As you quite rightly pointed out; the parametric singleton pattern (or the singleton pattern, for that matter) enable multiple threads to gain access to the same instance. The only way that I can see to block others from gaining access to the reference is the synchronize keyword. This is putting a spin-lock (or MUTEX) on the reference. The question of how to unit-test a design pattern like the parametric singleton remains open. Perhaps this is a deficiency. > >2) You cannot mockup a singleton. Once everyone calls the >SomeSingleton class statically, you can't >replace your class by SomeSingletonMockup. Acutally, I am not sure that this is true. If the Singleton implements a Facade interface, it should be possible to make the replacement. Right? > >Furthermore, even for hardware services, the Singleton pattern does >not really prevent concurrent >accesses. If you start the same program in two different JVMs, >unless they somehow shared the state >of their "Singletons" (through lock files for example), the >Singleton pattern will not prevent >concurrent access. Good Point!! You have sharp eyes! The singleton design pattern should/could take responsibility for this. In fact, you may notice that my code does have an implementation (LocateRegistry) that can work across JVM's. The LocateRegistry will even work across the Internet! LocateRegistry takes both a host name and a Port (lock files just don't do this). I did not think to implement this beyond the local machine, but, in its present form, it will work across different processes. > >Our application uses RXTX, and we routinely encounter cases where >another (native) application has >already locked the port. Since we cannot modify the native >application to recognize lock files, >OS-level control is irreplaceable. The singleton design pattern is not meant to replace OS-level control, but to centralize the Java programmers access to it. If lock files, for example, are used for serial ports, the Singleton Design Pattern should be able to work with them. > > >> >> Consequences >> The Parametric Singleton Design Pattern has several benefits: >> > > 1. Controlled access to parametrically defined instances. Since >> the Parametric Singleton class encapsulates its instances, there is >> control over how and when clients access it. > >Not really. Once you've returned the instance to a client, you've >lost control over it. The client >can to whatever it wants with it. You cannot "recall" the instance >or claim it back. Good point, this should read: > 1. Controll when parametrically defined instances are created. Since > > the Parametric Singleton class encapsulates its instances, there is > > control over how and when they are instanced. > >> 2. Reduced name space. The Parametric Singleton pattern avoids >> global variables that store instances created from the same parameter. > >Sure, but you don't have to rely on a Singleton for that. Just >create a single Factory. > > Thank you for your thoughtful and prompt response! Regards, - Doug From dmarkman at mac.com Wed Mar 22 21:21:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 22 Mar 2006 23:21:55 -0500 Subject: [Rxtx] sole of a new design pattern In-Reply-To: <442160DA.80107@trusted-logic.com> References: <442160DA.80107@trusted-logic.com> Message-ID: I don't think I get it On Mar 22, 2006, at 9:36 AM, David Garnier wrote: > Using the singleton pattern in this case is just convenient for the > programmer. Problems arises > pretty quickly, especially if you attempt to unit-test your classes. so you're saying that something isn't so good because you can not test it in the convenient way? if that's true, I'm totally disagree change your test, debug whatever, but if software is efficient at runtime, works fine and only problem is some unit test (which is some kind of framework for testing) then dump that unit test , dump that unit framework and make something appropriate to the software you're testing so if Douglas want to use singletons, what's the problem? and what do you mean by abusing of singleton usage? of course singleton doesn't prevent concurrent access to the resource across the processes unless you're using some OS facility to prevent it, besides singleton as it was introduced is relevant only and only inside of the same process otherwise it's not singleton it's something else (let's say network singleton: so you have remote invocation facility and some factory method that return object created by that facility) I don't have any problem with using any kind of singletons. Parametric Singleton idea (if I understand it right) could be easily implemented in the following way: use a map populate map with instances of some class and key is your parameter (you can use lazy population too) if somebody ask the key check the value if it's null so resource is taken if somebody returns the resource put it back to the map public synchronized static Object getSomeResource(Object parameter); public synchronized static void returnResource(Object parameter); getSomeResource (inside of the same process) could return null in 2 cases 1. if somebody (from other thread for example) already took that resource 2. if OS API said that resource corresponded to that parameter (serial port with parameter = 1 (port #)) is locked and unavailable; I'm not sure that in case of serial ports we even need those Parametric Singletons (unless lock checking is a very expensive operation) just ask the OS about availability of that resource and if it's available give it away and then OS will lock it and therefore in next time somebody ask it just answer that resource is locked and return null for example system has 2 serial ports available so I ask getResource("tty"); or I ask getResource("Bluetooth-Modem"); and if OS is ok you can give tty or Bluetooth-Modem or both no need for any additional pattern I think back to the problem mac os x doesn't recognize locking via files, so it handles locking via some API an instance of the singleton in each process should recognize that resource is locked (by using that API) that's all we don't have to make things more complicate then they are just because there is some nice design pattern or nice unit test framework or whatever keep things simple, make them work fast, don't introduce middle layers unless you have really good reason to do so of course I could be entirely wrong, so sorry about that in advance thanks Dmitry Markman From tjarvi at qbang.org Wed Mar 22 22:31:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 22 Mar 2006 22:31:41 -0700 (MST) Subject: [Rxtx] sole of a new design pattern In-Reply-To: References: Message-ID: Hi Doug Interesting reading. So far I'm just reading and thinking. I have one question so far. " Clients obtain a reference to a Parametric Singleton instance only through the parametric singleton design pattern. If the instance is left in an improper state (e.g., the serial port was left open) it is NOT the role of the Parametric Singleton Design Pattern to close the IO port. Nor is it the role of the Parametric Singleton Design Pattern to open the port. That role is delegate to some other part of the system. " So when the clients obtain a reference to the singleton, can they assume the port is there? IE, would it be the singletons role to handle things like USB dongles being removed with event hints comming from the underlying OS. Hardware abstraction layer/HAL on Linux is an example of underlying OS events. I assume that role too is delegated to other parts of the system? -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Thu Mar 23 08:10:33 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 23 Mar 2006 10:10:33 -0500 Subject: [Rxtx] Classes don't need goals, they need roles! In-Reply-To: References: Message-ID: Hi Trent, Yes, I think that the role of the Parametric Singleton Pattern is not to open or close serial ports, nor is it to perform error checking. On the other hand, if you were to combine the role of the Parametric Singleton Pattern with another role (like that of error checking) it might not be amiss. However, I generally caution programmers against adding multiple roles to classes, as this leads to monolithic designs. Thus a different class (NativeLibDetect) could have the role of determining if the native library can be loaded. Another class (SerialPortBean) can have the role of serializing the default state of the serial port, so that it can be recovered, from user preferences, at a later time. The SerialPortDetect could have the role of determining if the serial port is removed (i.e., a USB port was unplugged). My guess is that each class should have a different role in the system, in order to ease maintenance and testing...but I could be wrong about that. Thanks! - Doug >Hi Doug > >Interesting reading. So far I'm just reading and thinking. I have >one question so far. > >" > Clients obtain a reference to a Parametric Singleton instance only >through the parametric singleton design pattern. If the instance is >left in an improper state (e.g., the serial port was left open) it is >NOT the role of the Parametric Singleton Design Pattern to close the >IO port. Nor is it the role of the Parametric Singleton Design Pattern >to >open the port. That role is delegate to some other part of the system. >" > >So when the clients obtain a reference to the singleton, can they >assume the port is there? IE, would it be the singletons role to >handle things like USB dongles being removed with event hints >comming from the underlying OS. Hardware abstraction layer/HAL on >Linux is an example of underlying OS events. > >I assume that role too is delegated to other parts of the system? > >-- >Trent Jarvi >tjarvi at qbang.org >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From maximulo at yahoo.com Fri Mar 24 01:22:38 2006 From: maximulo at yahoo.com (Maximulo Majir) Date: Fri, 24 Mar 2006 00:22:38 -0800 (PST) Subject: [Rxtx] JavaPOS Message-ID: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Hi all! Hello Trent! From what i understand, RXTX or JavaComm APIs were not created solely for JavaPOS. In JavaPOS, we have the virtual method claim() which is separate from open(), but in our RXTX API, claiming is done every call to open(), we cant open the port if its claimed by another application. Would it be alright to suggest or ask to create a new method called claim(..)? Is there such thing as forceclaim() in RXTX? this could be the same as portownership transfer or its equivalent. ForceClaim is in JSR80. Do you have some samples using RXTX as the lower layer for the Device Service Objects in JavaPOS? I have tried it, i just want to compare. Thank you all! maxim __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060324/496adba2/attachment-0010.html From tjarvi at qbang.org Fri Mar 24 11:28:19 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:28:19 -0700 (MST) Subject: [Rxtx] Re: RXTX 2.1 Solaris Problems In-Reply-To: <3691.1143210578@www045.gmx.net> References: <3691.1143210578@www045.gmx.net> Message-ID: On Fri, 24 Mar 2006, Andreas Guenther wrote: > Hi all, > > the solaris problem was not the lock file only. > > Ok, I had to create the directory /var/spool/locks myself. > /var/spool/uucp exists. > > But rxtx didn't find any port. > > I compiled the source with my own debug-informations > and I tried to isolate the problem. > > The problem is the testRead-call in SerialImp.c > > JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)( > > ... > if ( READ( fd, &c, 1 ) < 0 ) > { > if ( errno != EAGAIN ) { > report( "testRead() read failed\n" ); > ret = JNI_FALSE; > } > } > Thanks Andreas I'm packing up to move. I'll be more or less away for a couple weeks here. I'll be checking email but my workstation is going into a box soon. This isn't hard to fix as this port should be enumerated when EWOULDBLOCK is recieved. Thats error is OK for enumeration just as EAGAIN is. I've put the bug into bugzilla so we dont forget to get to it. http://bugzilla.qbang.org/show_bug.cgi?id=42 You can add yourself to the CC list if you wish to test fixes we provide or even put a patch into bugzilla yourself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 24 11:51:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 24 Mar 2006 11:51:52 -0700 (MST) Subject: [Rxtx] JavaPOS In-Reply-To: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> References: <20060324082238.66371.qmail@web38214.mail.mud.yahoo.com> Message-ID: On Fri, 24 Mar 2006, Maximulo Majir wrote: > Hi all! Hello Trent! > > > From what i understand, RXTX or JavaComm APIs were not > created solely for JavaPOS. In JavaPOS, we have the virtual method > claim() which is separate from open(), but in our RXTX API, claiming is > done every call to open(), we cant open the port if its claimed by > another application. Would it be alright to suggest or ask to create a > new method called claim(..)? Is there such thing as forceclaim() in > RXTX? this could be the same as portownership transfer or its > equivalent. ForceClaim is in JSR80. > Do you have some samples using RXTX as the lower layer for the Device > Service Objects in JavaPOS? I have tried it, i just want to compare. > maxim Hi Maxim JSR80 is the USB API IBM/Sun put together. The problem is they have a richer kernel/API underneath that can handle such things. With Serial Ports, there isnt anything there other than an ioctl that says don't let anyone touch this and lockfiles that are more of a 'lets be nice.' At times we may be using USB ports but it is through the termios layer with the limitations mentioned. The advantage is that not only USB will work with rxtx. Anything that has a termios layer should work (to the extent that termios layer is complete). I don't know how forceclaim() would help you. Lets say someone has a programmer working on /dev/ttyS0 and you take it. Now you both race each other to read data first. There isn't a mechanism I know of that will solve this problem in termios. The most obvious test being a native app and a Java app trying to take the port. There is the potential of requestion ownership from other Java Applications but the use for that is very rare. Did you have something more specific in mind that I'm missing? I'm not sure that claim() and forceclaim() would help you with rxtx other than maybe locking the port with claim() without opening it. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 25 23:42:08 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 25 Mar 2006 23:42:08 -0700 (MST) Subject: [Rxtx] Serial snoop Message-ID: I was reading the Linux kernel mail-list tonight and ran past a thread that mentioned sersnoop. This looks like a handy tool for people dealing with new toys. "a simple command-line tool for linux that echoes bytes to and from any two serial ports, ptys, or network sockets, and prints all traffic to stdout, in hex and ascii." http://www.restivo.org/projects/sersnoop/ It works on Linux only at this time (debian package available). -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Sun Mar 26 07:32:35 2006 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 26 Mar 2006 09:32:35 -0500 Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. Message-ID: <4426A603.80508@gmail.com> Dear all, When trying to open the serial port, I sometimes (not always) run into the following exception (when opening the serialPort): Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is denied. java.lang.UnsatisfiedLinkError: native_psmisc_report_owner at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at codeskin.tools.CLLoader.open(CLLoader.java:79) at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) at java.lang.Thread.run(Unknown Source) Is this the type of error where I should just try to open the port again, or can it be avoided? Regards, Beat From tjarvi at qbang.org Sun Mar 26 11:40:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:40:12 -0700 (MST) Subject: [Rxtx] Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): Access is, denied. In-Reply-To: <4426A603.80508@gmail.com> References: <4426A603.80508@gmail.com> Message-ID: On Sun, 26 Mar 2006, Beat Arnet wrote: > Dear all, > > When trying to open the serial port, I sometimes (not always) run into > the following exception (when opening the serialPort): > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): > Access is > denied. > > java.lang.UnsatisfiedLinkError: native_psmisc_report_owner > at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native > Method) > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at codeskin.tools.CLLoader.open(CLLoader.java:79) > at codeskin.tools.C2000Programmer.run(C2000Programmer.java:220) > at java.lang.Thread.run(Unknown Source) > > Is this the type of error where I should just try to open the port again, > or can it be avoided? > Hi Beat We did a second build of rxtx 2.1-7 to resolve that unsatisfied link error. It should work now. rxtx is trying to tell you it thinks someone else has the serial port open. You can try to open the port again but maybe you already have a copy of the program running when it happens? ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7r2.zip fixed build. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Mar 26 11:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 11:44:23 -0700 (MST) Subject: [Rxtx] RXTX spec file (fwd) Message-ID: This is probably interesting for fedora/suse users. ---------- Forwarded message ---------- Date: Sun, 26 Mar 2006 16:25:45 +0200 To: taj at www.linux.org.uk Subject: RXTX spec file I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/6c7b6af6/rxtx-0010.pl From tjarvi at qbang.org Sun Mar 26 23:42:59 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 26 Mar 2006 23:42:59 -0700 (MST) Subject: [Rxtx] Upcomming events. Message-ID: This Wednesday we will be announcing a new "Maintainer" for the rxtx project. The position is more like neutral leader. I wont be going away or doing less. This is just the right thing to do as it turns out the two people with CVS write access will be at the same company. We need a third and we need neutrality. The maintainer will have final say in any conflict and will try to be neutral. It will be open for discussion. Then we will do it :) I'll still do most of the footwork I do now. But. I'm falling behind. I should have gone through the mail-list and posted the next round of changes this weekend. I'm packing to move and its going so so - 13 years of toys collected. I suspect there will be a dead period on my part (a couple weeks) comming up. But if you get it on the mail-list, we will get it in if there are no objections. I may well not be reading the mail-list during this period as I look for a house and many other things. I hope everyone will help out. Thanks -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 27 15:04:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 27 Mar 2006 15:04:16 -0700 (MST) Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: I'm probably not going to be able to resolve this. http://bugzilla.qbang.org/show_bug.cgi?id=43 Would a mail-list with just bugzilla reports be of use? -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Tue Mar 28 01:27:16 2006 From: joachim at buechse.de (Joachim Buechse) Date: Tue, 28 Mar 2006 10:27:16 +0200 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <01156D40-66FA-4708-9B4B-87F595EEBF45@buechse.de> I can have a look into this but I need to get a second KeySpan adapter. As I dont want to buy one this could get a bit tricky... Tim, are you shell save? If so, can you please start your application from a shell (ie with a full java -cp ... command), provoke the hang, then open a second shell. Use "ps | grep java" to find the process id of your java application and then use "kill -3 " to send it a signal. Example joachim$ java -cp classes:resource:lib/joelib.jar:lib/RXTXcomm.jar Starter joachim$ ps | grep java 227 p1 S+ 0:01.52 java -cp classes:resource:lib/ joelib.jar:lib/RXTXcomm 229 p2 S+ 0:00.01 grep java joachim$ kill -3 227 This will provide a full thread-dump of the hanging java vm. Please post a copy of this dump on bugzilla. It can provide some first hints if the problem is inside RXTX (ie a deadlock) or in the driver. Regards, Joachim On 28.03.2006, at 00:04, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From smontgomery at mediaspansoftware.com Tue Mar 28 08:25:20 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:25:20 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla Message-ID: <8252B48A-C8CC-40B2-82A8-3241C68478ED@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > From malek.sd at free.fr Tue Mar 28 14:42:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:42:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429ADAA.9060308@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. From tjarvi at qbang.org Tue Mar 28 13:51:01 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 28 Mar 2006 13:51:01 -0700 (MST) Subject: [Rxtx] RXTX spec file for RPM In-Reply-To: <4429ADAA.9060308@free.fr> References: <4429ADAA.9060308@free.fr> Message-ID: On Tue, 28 Mar 2006, Malek SD wrote: > I send you this spec file which allows to create a RPM for Fedora 4, 5 > (x86, x86_64) with Java Sun. Thanks Malek We will be incuding this in the tarball next release. -- Trent Jarvi tjarvi at qbang.org From mahmoud_hadad at yahoo.com Sun Mar 26 07:31:19 2006 From: mahmoud_hadad at yahoo.com (ronan nick) Date: Sun, 26 Mar 2006 06:31:19 -0800 (PST) Subject: [Rxtx] a question about the COMM API Message-ID: <20060326143119.54919.qmail@web60014.mail.yahoo.com> hi, i was intrested in knowing how i can communicate with my internal modem using java? for example if i want to make a phone dialer application or a caller id application where should i be looking at? and as i understood the COMM API is for devices that is attached to the computer through serial ports. --------------------------------- New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060326/ce8329f0/attachment-0010.html From smontgomery at mediaspansoftware.com Tue Mar 28 08:19:28 2006 From: smontgomery at mediaspansoftware.com (Sean Montgomery) Date: Tue, 28 Mar 2006 10:19:28 -0500 Subject: [Rxtx] Mac OS X specific bug in bugzilla In-Reply-To: References: Message-ID: <2FDE368B-08EC-4129-8A98-FC1A15F23D73@mediaspansoftware.com> The summary says using more than one port causes a hang, but the description says the hand occurs when reading from one port and writing to another. What happens if you're only reading from the two ports? Just FYI: I use a Keyspan on my Mac and have successfully written to one port while reading from the other, as well as reading from two, using Rxtx 2.0.7 on 10.3.x. I'm pretty sure I've tried 1 read & 1 write on 10.4.x, too, but I'll double check. I realize there's a big difference between 2.0.7 and 2.1.7, just providing a baseline of sorts. On Mar 27, 2006, at 5:04 PM, Trent Jarvi wrote: > > I'm probably not going to be able to resolve this. > > http://bugzilla.qbang.org/show_bug.cgi?id=43 > > Would a mail-list with just bugzilla reports be of use? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From malek.sd at free.fr Tue Mar 28 14:32:02 2006 From: malek.sd at free.fr (Malek SD) Date: Tue, 28 Mar 2006 23:32:02 +0200 Subject: [Rxtx] RXTX spec file for RPM Message-ID: <4429AB52.5080208@free.fr> I send you this spec file which allows to create a RPM for Fedora 4, 5 (x86, x86_64) with Java Sun. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rxtx.spec Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060328/7c291a8e/rxtx-0010.pl From lwensauer at atoss-csd.de Mon Mar 27 03:08:22 2006 From: lwensauer at atoss-csd.de (Ludwig Wensauer) Date: Mon, 27 Mar 2006 12:08:22 +0200 Subject: [Rxtx] Can't receive any response from modems Message-ID: <4427B996.3040709@atoss-csd.de> Hi Eugenia has already reported a bug: http://bugzilla.qbang.org/show_bug.cgi?id=41 I've got the simular problem and i made some analysis which you can read under the bug report. I've also sent a message to Trent, but unfortunatly he is far away from our earth ;) I've send him this message here: "... Hello, I've looked into the source code and i come to the following result: the function eventLoop is the key to our success, but must i change the SerialImpl.c or the SerialImpl.cpp? And Can I use the WaitCommEvent function? Or is it only a windows specific? My other problem is, until now I weren't able to install the required build environment (mingw,cygwin). btw a maybe helpfully link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ..." I hope that someone could help me. Cheers Ludwig Wensauer From MBecker at shot.com Wed Mar 29 09:29:15 2006 From: MBecker at shot.com (Becker, Matt) Date: Wed, 29 Mar 2006 11:29:15 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Hello, I originally developed this program using comm 2.0 for windows and all of my code worked perfectly. I now have had to move this program to a CentOS 4.2 machine and needed to get a new comm package. So I followed the instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml about installing rxtx and comm, but the program will not work now. I've included the error I receive and the code it refers to. I have not seen anything like this on the internet or in the mail list. Could you please help? Thanks, Matthew R. Becker Software Engineer SHOT 7200 Highway 150 Greenville, IN 47124 (812) 923-9591, extension 206 (812) 923-2243 Fax mbecker at SHOT.com The error I get is: init: deps-jar: Compiling 1 source file to /common/Cryma5/build/classes compile: run: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver null at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive at com.sun.comm.SunrayInfo.isSessionActive(Native Method) at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) at com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) at javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) at cryma5.TSerialPort.(TSerialPort.java:32) at cryma5.TCrystallographer.(TCrystallographer.java:33) at cryma5.MainForm.initAppComponents(MainForm.java:1049) at cryma5.MainForm.(MainForm.java:142) at cryma5.MainForm.main(MainForm.java:1040) Experimental: JNI_OnLoad called. Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds) The code is: /* * TSerialPort.java * * Created on November 11, 2004, 9:39 PM */ package cryma5; import java.io.*; import java.util.*; import javax.comm.*; /** * * @author Bill */ public class TSerialPort { static Enumeration portList; static CommPortIdentifier portId; static String messageString = "PM2\r\n"; //Set serial HUB into remote control mode. static SerialPort serialPort; static OutputStream outputStream; static InputStream inputStream; static BufferedReader inputReader; static boolean isOpen = false; private static Vector Listeners; /** Creates a new instance of TSerialPort */ public TSerialPort() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals("COM1") || //windows (portId.getName().equals("/dev/ttyS0"))) { //Linux try { serialPort = (SerialPort) portId.open("TSerial", 2000); isOpen = true; SerialRead reader = new SerialRead(); System.out.println("TSerial:Using Port:"+portId.getName()); } catch (PortInUseException e) {System.out.println("TSerial:Port in use error:"+e);} try { serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) {System.out.println("TSerial:PortParam error:"+e);} try { outputStream = serialPort.getOutputStream(); } catch (IOException e) {System.out.println("TSerial:getOutputStream error:"+e);} try { outputStream.write(messageString.getBytes()); } catch (IOException e) {System.out.println("TSerial:message error:"+e);} } } } } synchronized public static void Transmit(String data) { try { outputStream.write(data.getBytes()); // System.out.print("TSerial.Transmit:"+data); } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} } /** * Getter for property isOpen. * @return Value of property isOpen. */ public boolean isOpen() { return isOpen; } /** * Setter for property isOpen. * @param isOpen New value of property isOpen. */ public void setisOpen(boolean Open) { isOpen = Open; } public static void addTSerialListener(TSerialListener l) { if (Listeners == null) Listeners = new Vector(); Listeners.addElement(l); } public static void removeTSerialListener(TSerialListener l) { if (Listeners == null) return; Listeners.removeElement(l); } private void fireSerialISEvent(String rxdata) { if (Listeners == null) return; Vector l; synchronized (this) { l = (Vector)Listeners.clone(); //get a snapshot of listeners } //call each one for (Enumeration e = l.elements(); e.hasMoreElements();) { TSerialListener tl = (TSerialListener) e.nextElement(); tl.OnSerialSIReceive(rxdata); } } class SerialRead implements Runnable{ Thread readThread; public SerialRead() { try { inputStream = serialPort.getInputStream(); inputReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (IOException e) {} readThread = new Thread(this); readThread.setName("SerialReader"); readThread.start(); } public void run() { String inputString; try { while (isOpen) { inputString = inputReader.readLine(); //If Input Status command like "4IS=01010101" if (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) { fireSerialISEvent(inputString.substring(4)); //Send data part } else { TLog.Println("<"+ inputString + ">"); } } } catch (IOException e) {} System.out.println("TSerial.SerialRead:Closed."); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060329/10279c3f/attachment-0010.html From tjarvi at qbang.org Wed Mar 29 18:02:58 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 18:02:58 -0700 (MST) Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null In-Reply-To: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> References: <6866B9FD91DFD411945C000102BEFE0E026924BB@EARTH> Message-ID: Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > From tjarvi at qbang.org Wed Mar 29 22:51:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 29 Mar 2006 22:51:30 -0700 (MST) Subject: [Rxtx] Changes in RXTX Leadership Message-ID: As mentioned earlier, I will be taking a position at The MathWorks. Some of my duties will revolve around RXTX. This should be a great thing for RXTX as I will be finding and fixing bugs in a more formal process. In theory, there could be conflicts of interest between my job and the RXTX community. I will be signing a fairly typical Employment Agreement which may limit my ability to make the best timely decisions for RXTX should a conflict come up. This is not the intent. Carving exceptions out in legal paperwork is a bit cumbersome. An easy way to solve this is to hand over primary decision making capability to someone we all trust. I can continue to help the project as always but should conflicts come up, the new maintainer would have the final say. I've asked Dr. Douglas Lyon if he would be interested in taking this position. He has kindly offered to accept should we all agree. This should not represent a new work load for Doug. His responsibility would be to have the final say in disputes. I think Doug would be excellent for this position. He has shown an active interest in the well being of the RXTX project and has been working hard to make RXTX easier to install for end users. Perhaps this will help his work too. It is the intent of The MathWorks and myself to do the right thing for the RXTX community. This is perhaps the cleanest solution which handles any potential conflicts. I'm rather excited about it. -- Trent Jarvi tjarvi at qbang.org From MBecker at shot.com Thu Mar 30 09:05:34 2006 From: MBecker at shot.com (Becker, Matt) Date: Thu, 30 Mar 2006 11:05:34 -0500 Subject: [Rxtx] java.io.IOException: Error instantiating class gnu.io. RXTXCommDri ver null Message-ID: <6866B9FD91DFD411945C000102BEFE0E026924C8@EARTH> Thanks for the help, I'll try it out. -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 29, 2006 8:03 PM To: RXTX Developers and Users Subject: Re: [Rxtx] java.io.IOException: Error instantiating class gnu.io.RXTXCommDri ver null Hi Matt " Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive \uffff\uffff\uffff\uffff\uffff\uffff\uffff at com.sun.comm.SunrayInfo.isSessionActive(Native Method) \uffff\uffff\uffff\uffff\uffff\uffff\uffff at "" rxtx 2.1 does not work with Sun's commapi. It is in package gnu.io and works like Sun's version 2.0. There is not way rxtx can work with Sun's Version 3.0 and that is supposed to be in the works to be fixed. Basically, the project had a change in leadership at Sun and the new guy didn't realize how their package was being used. Now they know and are fixing it but with limited resources. You can use rxtx 2.0 with Sun's version 2.0. Do not mix packages though. Either use gnu.io (rxtx 2.1) or javax.comm (rxtx 2.0, sun 2.0). Sun does have the old 2.0 CommAPI available for download in their archives. I don't have the link handy though. See also this email linked on the front page at rxtx.org: http://mailman.qbang.org/pipermail/rxtx/20051216/001960.html On Wed, 29 Mar 2006, Becker, Matt wrote: > Hello, > I originally developed this program using comm 2.0 for windows and > all of my code worked perfectly. I now have had to move this program to a > CentOS 4.2 machine and needed to get a new comm package. So I followed the > instructions on http://wass.homelinux.net/howtos/Comm_How-To.shtml > about installing rxtx > and comm, but the program will not work now. I've included the error I > receive and the code it refers to. I have not seen anything like this on > the internet or in the mail list. Could you please help? > Thanks, > Matthew R. Becker > Software Engineer > SHOT > 7200 Highway 150 > Greenville, IN 47124 > (812) 923-9591, extension 206 > (812) 923-2243 Fax > mbecker at SHOT.com > > > The error I get is: > > init: > deps-jar: > Compiling 1 source file to /common/Cryma5/build/classes > compile: > run: > Stable Library > ========================================= > > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Error instantiating class gnu.io.RXTXCommDriver > null > at > javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:109) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Exception in thread "main" java.lang.UnsatisfiedLinkError: isSessionActive > at com.sun.comm.SunrayInfo.isSessionActive(Native Method) > at com.sun.comm.Portmapping.registerCommPorts(Portmapping.java:155) > at > com.sun.comm.Portmapping.refreshPortDatabase(Portmapping.java:100) > at > javax.comm.CommPortIdentifier.(CommPortIdentifier.java:138) > at cryma5.TSerialPort.(TSerialPort.java:32) > at cryma5.TCrystallographer.(TCrystallographer.java:33) > at cryma5.MainForm.initAppComponents(MainForm.java:1049) > at cryma5.MainForm.(MainForm.java:142) > at cryma5.MainForm.main(MainForm.java:1040) > Experimental: JNI_OnLoad called. > Java Result: 1 > BUILD SUCCESSFUL (total time: 2 seconds) > > The code is: > /* > * TSerialPort.java > * > * Created on November 11, 2004, 9:39 PM > */ > > package cryma5; > > import java.io.*; > import java.util.*; > import javax.comm.*; > > /** > * > * @author Bill > */ > public class TSerialPort > { > static Enumeration portList; > static CommPortIdentifier portId; > static String messageString = "PM2\r\n"; //Set serial HUB into remote > control mode. > static SerialPort serialPort; > static OutputStream outputStream; > static InputStream inputStream; > static BufferedReader inputReader; > static boolean isOpen = false; > private static Vector Listeners; > > /** Creates a new instance of TSerialPort */ > public TSerialPort() > { > portList = CommPortIdentifier.getPortIdentifiers(); > > while (portList.hasMoreElements()) { > portId = (CommPortIdentifier) portList.nextElement(); > if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { > if (portId.getName().equals("COM1") || //windows > (portId.getName().equals("/dev/ttyS0"))) { //Linux > try { > serialPort = (SerialPort) > portId.open("TSerial", 2000); > isOpen = true; > SerialRead reader = new SerialRead(); > System.out.println("TSerial:Using > Port:"+portId.getName()); > } catch (PortInUseException e) > {System.out.println("TSerial:Port in use error:"+e);} > try { > serialPort.setSerialPortParams(9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > } catch (UnsupportedCommOperationException e) > {System.out.println("TSerial:PortParam error:"+e);} > try { > outputStream = serialPort.getOutputStream(); > } catch (IOException e) > {System.out.println("TSerial:getOutputStream error:"+e);} > try { > outputStream.write(messageString.getBytes()); > } catch (IOException e) > {System.out.println("TSerial:message error:"+e);} > } > } > } > } > synchronized public static void Transmit(String data) > { > try { > outputStream.write(data.getBytes()); > // System.out.print("TSerial.Transmit:"+data); > } catch (Throwable e) {System.out.println("TSerial.Transmit:"+e);} > } > > /** > * Getter for property isOpen. > * @return Value of property isOpen. > */ > public boolean isOpen() { > return isOpen; > } > > /** > * Setter for property isOpen. > * @param isOpen New value of property isOpen. > */ > public void setisOpen(boolean Open) { > isOpen = Open; > } > > public static void addTSerialListener(TSerialListener l) > { > if (Listeners == null) Listeners = new Vector(); > Listeners.addElement(l); > } > > public static void removeTSerialListener(TSerialListener l) > { > if (Listeners == null) return; > Listeners.removeElement(l); > } > > private void fireSerialISEvent(String rxdata) > { > if (Listeners == null) return; > Vector l; > synchronized (this) { > l = (Vector)Listeners.clone(); //get a snapshot of listeners > } > //call each one > for (Enumeration e = l.elements(); e.hasMoreElements();) { > TSerialListener tl = (TSerialListener) e.nextElement(); > tl.OnSerialSIReceive(rxdata); > } > } > > class SerialRead implements Runnable{ > > Thread readThread; > > public SerialRead() { > try { > inputStream = serialPort.getInputStream(); > inputReader = new BufferedReader(new > InputStreamReader(inputStream)); > } catch (IOException e) {} > readThread = new Thread(this); > readThread.setName("SerialReader"); > readThread.start(); > } > > public void run() { > String inputString; > try { > while (isOpen) { > inputString = inputReader.readLine(); > //If Input Status command like "4IS=01010101" > if > (inputString.startsWith(TSerialCmd.SWITCH_IMP_CH+TSerialCmd.INPUT_STATUS)) > { > fireSerialISEvent(inputString.substring(4)); //Send > data part > } > else > { > TLog.Println("<"+ inputString + ">"); > } > } > } catch (IOException e) {} > System.out.println("TSerial.SerialRead:Closed."); > } > > > } > > } > > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From lux at diesel-research.com Fri Mar 31 18:00:50 2006 From: lux at diesel-research.com (Kim Lux) Date: Fri, 31 Mar 2006 18:00:50 -0700 Subject: [Rxtx] Changes in RXTX Leadership In-Reply-To: References: Message-ID: <1143853250.16782.0.camel@zd7280> If you think he is good, Trent, I trust your judgement. On Wed, 2006-03-29 at 22:51 -0700, Trent Jarvi wrote: > > As mentioned earlier, I will be taking a position at The MathWorks. > Some of my duties will revolve around RXTX. This should be a great > thing for RXTX as I will be finding and fixing bugs in a more formal > process. > > In theory, there could be conflicts of interest between my job and the > RXTX community. > > I will be signing a fairly typical Employment Agreement which may limit my > ability to make the best timely decisions for RXTX should a conflict come > up. This is not the intent. Carving exceptions out in legal paperwork is > a bit cumbersome. > > An easy way to solve this is to hand over primary decision making > capability to someone we all trust. I can continue to help the project > as always but should conflicts come up, the new maintainer would have > the final say. > > I've asked Dr. Douglas Lyon if he would be interested in taking this > position. He has kindly offered to accept should we all agree. This > should not represent a new work load for Doug. His responsibility would > be to have the final say in disputes. I think Doug would be excellent > for this position. He has shown an active interest in the well being of > the RXTX project and has been working hard to make RXTX easier to > install for end users. Perhaps this will help his work too. > > It is the intent of The MathWorks and myself to do the right thing for > the RXTX community. This is perhaps the cleanest solution which handles > any potential conflicts. I'm rather excited about it. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -- Kim Lux, Diesel Research Inc. From Lars.Hennig at wow-portal.com Fri Mar 31 07:26:39 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Fri, 31 Mar 2006 14:26:39 -0000 Subject: [Rxtx] Problems using Serial to USB Driver under Win32 Message-ID: Hello, I am connecting to a virtual serial port on a Win32 system. The real device behind this port is an USB device. Communication work fine until we disconnect the USB-cable from the PC while the communication is running. In this moment the communication hangs up and can not be recovered. The rxtx library enters the function nativeavailable and is not returning. In the cpp-source I found the following comment: result = PortArray[fd]->WaitForInput(); // WaitForInput() not the best choice, but all I could find. Could it be that this function is not returning when the virtual port disappears from the system when unplugging the USB-cable? Is the any way to avoid this behavior? Regards, Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060331/7752bd75/attachment-0010.html From tjarvi at qbang.org Wed Mar 1 00:31:49 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:31:49 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348467F@hqexchange3.dot.state.co.us> Message-ID: On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unkn > own-linux-gnu/ > > Here is some of the system information > -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l > inux-ia32, Native Threads, GC strategy: parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th > rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:35:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:35:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB034846B9@hqexchange3.dot.state.co.us> Message-ID: On Tue, 28 Feb 2006, Kharbanda, Pawan wrote: > Rajesh, > Thanks for the quick reply. We tried exporting LD_LIBRARY_PATH, we > also tried building the RXTX binaries using the source, but getting the > same result. > > Just curious, is anyhting major changed in between rxtx2.1.7pre17 and > the latest release. We were running our application in production for > almost a year using the older api's,but now when i am trying to upgrade > it is causing all kind of issues with rxtx on both (32 and 64 bit linux > machines). > > What sort of issues are you running into? Since 2.1.7pre17, it has only been bug fixes. See ChangeLog in the source for details. I'm curious what you are seeing. I imagine if you are mixing pre17 and 7, you will run into problems as there are changes in the native interface. The install issue appears fairly easy to fix as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 00:57:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 00:57:25 -0700 (MST) Subject: AW: [Rxtx] Strange error occuring w/ rxtx 1.4 for arm-linux In-Reply-To: References: <200602161546.k1GFk4iE001006@farad.et-inf.fho-emden.de> Message-ID: Hi Phillip Thats not exactly explicitly setting the parameters but just reading them. There may be bugs in the windows ioctls for instance when looking at those. I would explicitly set the port the way you want it. What is 'port' in this case? IE what kernel driver are you talking to on the Linux system? On Tue, 28 Feb 2006, Philipp Kemmeter wrote: > Heya! > > Well, this does not seem to be the solution. I've added the following > lines to my code: > > System.out.println("Flowcontrol: " + serialPort.getFlowControlMode()); > System.out.println("Treshold: " +serialPort.getReceiveThreshold()); > System.out.println("Timeout: " + serialPort.getReceiveTimeout()); > > The Output is on each of those three '0' - on both systems, linux and > windows. So I think the point has to be somewhere else... > > Any Idea ? > > 2006/2/23, Philipp Kemmeter : >> Okay, thanks alot so far. I will freeze the project till tuesday, >> because we have vacations here. I'm going to try the things you've >> said then. >> >> Phil >> >> 2006/2/23, Trent Jarvi : >>> >>> Hi Philipp >>> >>> You will want to set the following explicitly when you are unsure and >>> seeing differences between windows and linux. >>> >>> timeout >>> treshold >>> flow control mode (none xon/xoff hardware/... >>> >>> These are all in the javadoc for sun's CommAPI. You can probably see what >>> windows has set too. >>> >>> The defaults are whatever the OS is doing. Usually thats right. But I've >>> not characterized them. I don't think sun documented defaults either. >>> >>> So one of the above could be causing the issue. Especially flow control. >>> >>> I can say more Sunday if you still have problems. I'm getting ready to >>> head back home. >>> >>> On Thu, 23 Feb 2006, Philipp Kemmeter wrote: >>> >>>> Well, I think I give you the code. Look at it, if you want to. >>>> >>>> /** Method to initialize the serial port and set up the >>>> * input and output streams >>>> * >>>> */ >>>> public Receiver() { >>>> Enumeration portList; // will hold all the ports available on the system >>>> CommPortIdentifier portId = null; // will hold the current single >>>> port as we loop hrough all available in the system >>>> SerialPort serialPort = null; // this will hold the serial port >>>> choosen to be used >>>> boolean portFound = false; // wether the decided port was found or >>>> not (if not, maybe it's blocked by another application) >>>> >>>> // get all avaliable ports in the system >>>> portList = CommPortIdentifier.getPortIdentifiers(); >>>> // loop through all ports and find the desired port to use >>>> while (portList.hasMoreElements() && !portFound) { >>>> >>>> // get the port id >>>> portId = (CommPortIdentifier) portList.nextElement(); >>>> // check and make sure port type is serial (and not paralel or other) >>>> if(portId.getPortType()==CommPortIdentifier.PORT_SERIAL) { >>>> // then check that the port is the requested one >>>> System.out.println(portId.getName()); >>>> if(portId.getName().equalsIgnoreCase(port)) { >>>> try { >>>> portFound = true; >>>> // Open the serial port. The name is unimportant, >>>> // The second (timeout) parameter is unimplemented >>>> serialPort = (SerialPort) portId.open("Pic Receiver",30*1000); >>>> // Set the baud rate, etc, use 115 kbaud to make it more stressful >>>> >>>> serialPort.setSerialPortParams(BAUD, DATABITS, STOPBITS, PARITY); >>>> >>>> //System.out.println("Serial Port free"); >>>> // Register for notification of data changes >>>> try { >>>> serialPort.addEventListener(this); >>>> } >>>> catch (Exception tml) { >>>> System.out.println("addEventListener error " + >>>> tml.toString() + ": " + tml.getMessage()); >>>> System.exit(1); >>>> } >>>> SerialPort.notifyOnDataAvailable(true); >>>> // Get output and input streams >>>> outStream = serialPort.getOutputStream(); >>>> inStream = serialPort.getInputStream(); >>>> >>>> } catch (UnsupportedCommOperationException ucoe) { >>>> System.out.println("Error: UnsupportedCommOperationException"); >>>> System.exit(1); >>>> } catch (PortInUseException piue) { >>>> System.out.println("Error: PortInUseException"); >>>> System.exit(1); >>>> } catch (java.io.IOException ioe) { >>>> System.out.println("Error: IOException"); >>>> System.exit(1); >>>> } >>>> } //end if >>>> } // end if >>>> } // end while >>>> if (portFound) >>>> System.out.println("Server up, waiting for data..."); >>>> else { >>>> System.out.println("Error: Did not found the given port to listen. >>>> Maybe it's blocked by another application or it simply does not >>>> exist."); >>>> System.exit(0); >>>> } >>>> } // end method >>>> >>>> /** Javax.comm will call this method whenever a Data Available event occurs >>>> * On serial ports without hardware flow control this is the only >>>> event supported. >>>> * This means the onboard UARTs of JStamp/JStik/SaJe >>>> * >>>> * @params ev this is the serial event >>>> */ >>>> public void serialEvent(SerialPortEvent ev) { >>>> try { >>>> // only event supported on the aj100 >>>> if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { >>>> try { >>>> /* If contentLength isn't set yet, then the header has not >>>> been send properly. >>>> * Thus, it is first nessesary to parse the header to know, >>>> how many bytes are needed to get. >>>> */ >>>> >>>> // [... the parser was here - it's cut out because it does >>>> not really matter. It initializes contentLenght...] >>>> >>>> rcvBytes = new byte[contentLength]; >>>> >>>> /* Now just read the files. The Buffer should be big enough for >>>> * our needs >>>> */ >>>> byte[] readBuffer = new byte[2048]; >>>> while (inStream.available() > 0) { >>>> int numBytes = inStream.read(readBuffer); >>>> for (int i = 0; i < numBytes; i++) { >>>> rcvBytes[i+rcvByteCount] = readBuffer[i]; >>>> } >>>> >>>> rcvByteCount += numBytes; >>>> >>>> System.out.println(rcvByteCount); >>>> } >>>> >>>> /* Storing the arrived data and resetting the Receiver when >>>> the file has arrived. */ >>>> if (rcvByteCount >= contentLength) { >>>> System.out.println("done"); >>>> contentLength = 0; >>>> rcvByteCount = 0; >>>> } >>>> >>>> } catch (IOException e) { >>>> System.out.println("IOException caught in serialEvent"); >>>> } >>>> } >>>> } catch (Exception e) { >>>> System.out.println("Exception caught outside serialEvent: " + e.toString()); >>>> e.printStackTrace(); >>>> } >>>> >>>> } // end serialEvent >>>> >>>> >>>> >>>> >>>> 2006/2/23, Philipp Kemmeter : >>>>> Heya! >>>>> >>>>>> >>>>>> Have you turned on hardware flow control? Doing a cat suggests some parts >>>>>> of the driver are correct. If its open source, the odds are good the >>>>>> entire driver is correct. But cat does not do very much. >>>>>> >>>>> >>>>> Well, I don't know exactly, what you mean and where to do this. The >>>>> java-application works fine on the windows-machine, thus the setting >>>>> there should be correct. Also the mobile device I am using (Nokia N90) >>>>> is the same and working with the windows machine. Thus the settings >>>>> there should be correct to. What is left is the mobile device with >>>>> arm-linux on it. But cat is working fine there. >>>>> Any further details/suggestions ? >>>>> >>>>>> If someone wants to do something with rxtx 2.0 they can. I will not be >>>>>> looking at it until after the known issues are resolved and sun offers a >>>>>> release or prerelease to work with. It's a waste of time until then. >>>>>> >>>>>> But I doubt 2.0 will help you because rxtx 2.0 and 2.1 use the same native >>>>>> code with just some names changed to protect the inocent. >>>>> >>>>> I trust you in this. But what to do know? >>>>> >>>>> Do you want to look at my code and check it? >>>>> >>>>> Phil >>>>> >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Wed Mar 1 10:03:56 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:03:56 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of > our problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) > # export JAVA_HOME=/opt/java1.5 > # export PATH=$JAVA_HOME/bin:$PATH > # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so > #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped > # cd rxtx-2.1-7/contrib > # java Test /dev/cub00 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 10:36:18 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 10:36:18 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: Message-ID: On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName property > is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 11:32:18 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 11:32:18 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Trent, I finally got it to work. I found 2 issues : 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 we are setting System.setProperties(p), this causes the system properties to be overwritten by the gnu.io.rxtx.properties file thus leading to Null pointer exception all over the place. Properties p=new Properties(); p.load(rxtx_prop); //System.setProperties(p); >> LINE 362 for (Iterator it = p.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); System.setProperty(key, p.getProperty(key)); } So when I commented the line and rebuild the RXTX jar files it worked great after that. 2) Second culprit, we were using the wrong Test program to test the new API's. Test.java test program is not correct it starts with the call to the RXTXCommDriver constructor and initialize() method is never called from the RXTXCommDriver constructor resulting in no initailization of the RXTXCommDrivers. If we call the initialize() explicitly from the Test.java it works fine. I am glad in the end I finally got it to work together, because I really wanted the final release of rxtx because it fixed some of the issues that I have found in our production environment. Also if you want to add Colorado Department of Transportation in you list of users using the RXTX driver will be great. We use RXTX very heavily in our application, we communicate to few hundred traffic devices every minute to dissiminate the Traffic information to public, media and other partners using our Communication Server which is build on top of RXTX API's(for serial communications). Thanks for all your help, you were a great help. ~pawan -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:36 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > Ran the following as root and still get java.lang.NullPointerException. > NullPointerException is coming through code, looks like osName > property is not set or overridden. > > # java Test /dev/ttyS0 > opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) Hi John. Hmm. Try this Test.java I modified the code to enumerate ports like is usually done. I'll have to look at that Test.java and figure out whats going on. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/contrib/Test.java uname -a Linux www.qbang.org 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:16:33 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS0 open Ports Get Streams Baud is 9600 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 19200 Bits is 8 Stop is 1 Par is 0 Set Params Baud is 9600 Bits is 7 Stop is 2 Par is 1 Sending 0x01 0x01 Sent That should get Pawan up and going. -- Trent Jarvi tjarvi at qbang.org From tod at todbot.com Wed Mar 1 11:48:46 2006 From: tod at todbot.com (Tod E.Kurt) Date: Wed, 1 Mar 2006 10:48:46 -0800 Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch Message-ID: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Hi, When trying the Mac OS X version of RXTX available in either: ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip I get the message: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7 WARNING: RXTX Version mismatch Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7pre20 Doing strings on the relevant files shows this to be the case too: % strings gnu/io/RXTXVersion.class | grep RXTX- RXTX-2.1-7 % strings librxtxSerial.jnilib | grep RXTX- RXTX-2.1-7pre20 Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? Did the native library not get recompiled for the final 2.1-7 release? When I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild librxtxSerial.jnilib, I get the correct version, which makes me think perhaps it didn't get rebuilt in the release. Is this correct? Thanks, -=tod From tjarvi at qbang.org Wed Mar 1 11:49:16 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:49:16 -0700 (MST) Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line 362 > we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the new > API's. Test.java test program is not correct it starts with the call to > the RXTXCommDriver constructor and initialize() method is never called > from the RXTXCommDriver constructor resulting in no initailization of > the RXTXCommDrivers. If we call the initialize() explicitly from the > Test.java it works fine. > > I am glad in the end I finally got it to work together, because I really > wanted the final release of rxtx because it fixed some of the issues > that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 1 11:55:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 11:55:25 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX-2.1-7 version mismatch In-Reply-To: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> References: <99B62207-78CE-46EC-ADC4-EF7628444F79@todbot.com> Message-ID: On Wed, 1 Mar 2006, Tod E.Kurt wrote: > Hi, > > When trying the Mac OS X version of RXTX available in either: > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins.zip > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7.zip > > I get the message: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7pre20 > Java lib Version = RXTX-2.1-7 > WARNING: RXTX Version mismatch > Jar version = RXTX-2.1-7 > native lib Version = RXTX-2.1-7pre20 > > Doing strings on the relevant files shows this to be the case too: > > % strings gnu/io/RXTXVersion.class | grep RXTX- > RXTX-2.1-7 > % strings librxtxSerial.jnilib | grep RXTX- > RXTX-2.1-7pre20 > > Is this is a problem? Is RXTX-2.1-7pre20 exactly the same as RXTX-2.1-7? > Did the native library not get recompiled for the final 2.1-7 release? When > I unstuff the 'LibSerial.pbproj.sit.hqx' Xcode project and rebuild > librxtxSerial.jnilib, I get the correct version, which makes me think perhaps > it didn't get rebuilt in the release. Is this correct? > Hi Tod I'll put out new bins today. We had a problem with the windows binary too. Dmitry recompiled Mac OS X in CVS afterwards. 2.1-7pre20 isn't the same. It just got missed via miscommunication. I thought it had been built but it wasn't when we did the release. The only changes will be correct builds for Mac OS X and windows. -- Trent Jarvi tjarvi at qbang.org From Pawan.Kharbanda at dot.state.co.us Wed Mar 1 12:54:35 2006 From: Pawan.Kharbanda at dot.state.co.us (Kharbanda, Pawan) Date: Wed, 1 Mar 2006 12:54:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: <939A619A756047469C41EE9BA51890FB03484779@hqexchange3.dot.state.co.us> Trent, Excellent, not very far from where we are. You can check the techincal docs at http://www.cotrip.org/its/ctms_doc/index.html and also visit the www.cotrip.org for real time travel information. These docs are little old, we just went live few backs and right now in process of releasing a patch for some of the performance issues, we will be updating these docs soon. Thanks again for all your help. ~pk -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 11:49 AM To: Kharbanda, Pawan Cc: Trent Jarvi; Williams, John D; RXTX Developers and Users Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Kharbanda, Pawan wrote: > Trent, > I finally got it to work. I found 2 issues : > 1) First of all, I don't know why in the RXTXCommDriver.java at line > 362 we are setting System.setProperties(p), this causes the system > properties to be overwritten by the gnu.io.rxtx.properties file thus > leading to Null pointer exception all over the place. > Properties p=new Properties(); > p.load(rxtx_prop); > //System.setProperties(p); >> LINE 362 > for (Iterator it = p.keySet().iterator(); > it.hasNext();) { > String key = (String) it.next(); > System.setProperty(key, p.getProperty(key)); > } > So when I commented the line and rebuild the RXTX jar files it worked > great after that. > > 2) Second culprit, we were using the wrong Test program to test the > new API's. Test.java test program is not correct it starts with the > call to the RXTXCommDriver constructor and initialize() method is > never called from the RXTXCommDriver constructor resulting in no > initailization of the RXTXCommDrivers. If we call the initialize() > explicitly from the Test.java it works fine. > > I am glad in the end I finally got it to work together, because I > really wanted the final release of rxtx because it fixed some of the > issues that I have found in our production environment. > > Also if you want to add Colorado Department of Transportation in you > list of users using the RXTX driver will be great. We use RXTX very > heavily in our application, we communicate to few hundred traffic > devices every minute to dissiminate the Traffic information to public, > media and other partners using our Communication Server which is build > on top of RXTX API's(for serial communications). > > Thanks for all your help, you were a great help. > Neat. I currently live in Fort Collins, Colorado. Do you have a web page for your project? Thanks for the analysis of the problems. I'll get some patches together for those. Looks like Test.java is a good test for them :) -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Wed Mar 1 13:06:48 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Wed, 1 Mar 2006 15:06:48 -0500 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit In-Reply-To: References: <939A619A756047469C41EE9BA51890FB0348476F@hqexchange3.dot.state.co.us> Message-ID: <5BC4181F-CB25-4E4D-8117-2D7DC9DA3026@baseview.com> On Mar 1, 2006, at 1:49 PM, Trent Jarvi wrote: > Neat. I currently live in Fort Collins, Colorado. Lucky devil... New Belgium is a Fort Collins brewery that makes "La Folie", the best Flanders red ale in the U.S. Sorry, had to say it. Uh, let's see, malt, hmm... consider it "cereal" communications. ;-) From tjarvi at qbang.org Wed Mar 1 20:44:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 1 Mar 2006 20:44:23 -0700 (MST) Subject: [Rxtx] New binaries Message-ID: Wed Mar 1 2006 RXTX 2.1-7r2 (Final) Source and Binaries are now Available! There are no source changes. Mac OS X binaries are updated from a current build and a problem with win32 libraries was fixed. We found problems with the binaries and had to recompile to fix them. http://www.rxtx.org This just fixes the two issues seen with the binaries on the mail-list. I updated the 'source' for Mac OS X as it has the binaries in the tree. The w32 library has all the native functions linked in. There are no material source changes; it's just build fixes. This is the second release of rxtx-2.1-7 binaries. The version did not change. I've just replaced the two faulty files in the ToyBox and left a comment saying as much in the directories. I'll get the wiki up next. Then I'll start putting the changes in CVS from the mail-list. I'll have time this weekend to get it all done and some. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 09:51:35 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 09:51:35 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, I'm the Sys Admin working with Pawan, below are the details of our problem Environment setup # uname -a Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc glibc-2.3.4-2.13 #rpm -q binutils binutils-2.15.92.0.2-15 # java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 Created file /etc/ld.so.conf.d/java1.5 file contains /opt/java1.5/jre/lib/amd64 # ldconfig # ldconfig -v | grep librxtx librxtxParallel-2.1-7.so -> librxtxParallel.so librxtxRaw-2.1-7.so -> librxtxRaw.so librxtxSerial-2.1-7.so -> librxtxSerial.so librxtxI2C-2.1-7.so -> librxtxI2C.so librxtxRS485-2.1-7.so -> librxtxRS485.so #file /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test /dev/cub00 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 which throws java.lang.UnsatisfiedLinkError: JDK BEA JRockit(R) (build R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws java.lang.NullPointerException Thanks for your help John -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 12:32 AM To: RXTX Developers and Users Cc: Williams, John D Subject: Re: [Rxtx] Problems with rxtx on Linux 64 Bit On Mon, 27 Feb 2006, Kharbanda, Pawan wrote: > Hi, > We installed the new rxtx 2.1.7 (final version) on the 64 bit > machines. And when I run the SimpleRead program I am getting > "java.lang.UnsatisfiedLinkError" see detailed error below. > > We copied the binaries from > ftp://ftp.qbang.org/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-un > kn > own-linux-gnu/ > > Here is some of the system information -sh-3.00$ rpm -q glibc > glibc-2.3.4-2.13 > > -sh-3.00$ rpm -q binutils > binutils-2.15.92.0.2-15 > > -sh-3.00$ uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11: > 56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux > > > we are using BEA JRockit JVM :) > -sh-3.00$ java -version > java version "1.4.2_05" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04) > BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 (build > ari-38317-20041124-1225-l inux-ia32, Native Threads, GC strategy: > parallel) > > Does anybody has any ideas why I am getting this error ? > > Thanks in advance > ~pawan > > > -sh-3.00$ java SimpleRead /dev/cub00 > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory th rown while loading gnu.io.RXTXCommDriver > java.lang.UnsatisfiedLinkError: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i38 > 6/librxtxSerial-2.1-7.so: > /usr/lib/jvm/java-1.4.2-bea-1.4.2.05/jre/lib/i386/libr > xtxSerial-2.1-7.so: cannot open shared object file: No such file or > directory > at > java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)I(Unknown > Source) > at > java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z( > Unknown Source) > at > java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String; > Z)V(Unknown Source) > at > java.lang.Runtime.loadLibrary0(Ljava.lang.Class;Ljava.lang.String;)V( > Unknown Source) > at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown > Source) > at > gnu.io.CommPortIdentifier.()V(CommPortIdentifier.java:83) > at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source) > at jrockit.vm.RNI.trampoline()V(Unknown Source) > at > gnu.io.CommPortIdentifier.getPortIdentifiers()Ljava.util.Enumeration; > (CommPortIdentifier.java:???) > at SimpleRead.main([Ljava.lang.String;)V(SimpleRead.java:43) > The library should be fine. $ file /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so /var/ftp/pub/rxtx/lastbuild/rxtx-2.1-7-bins/Linux/x86_64-unknown-linux-g nu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped So just make sure it is placed in the right location. This should be .../jdk-version/jre/lib/amd64 or such. -- Trent Jarvi tjarvi at qbang.org From John.D.Williams at dot.state.co.us Wed Mar 1 10:13:41 2006 From: John.D.Williams at dot.state.co.us (Williams, John D) Date: Wed, 1 Mar 2006 10:13:41 -0700 Subject: [Rxtx] Problems with rxtx on Linux 64 Bit Message-ID: Trent, Ran the following as root and still get java.lang.NullPointerException. NullPointerException is coming through code, looks like osName property is not set or overridden. # java Test /dev/ttyS0 opening the Port: /dev/ttyS0 Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 open Ports Exception in thread "main" java.lang.NullPointerException at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) at Test.(Test.java:29) at Test.main(Test.java:23) -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, March 01, 2006 10:04 AM To: Williams, John D Cc: Trent Jarvi; RXTX Developers and Users; Kharbanda, Pawan Subject: RE: [Rxtx] Problems with rxtx on Linux 64 Bit On Wed, 1 Mar 2006, Williams, John D wrote: > Trent, > > I'm the Sys Admin working with Pawan, below are the details of our > problem > > Environment setup > > # uname -a > Linux tocrhstg03.cdot-toc.state.co.us 2.6.9-22.0.2.ELsmp #1 SMP Thu > Jan > 5 17:11:56 EST 2006 x86_64 x86_64 x86_64 GNU/Linux # rpm -q glibc > glibc-2.3.4-2.13 > #rpm -q binutils > binutils-2.15.92.0.2-15 > # java -version > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode) # > export JAVA_HOME=/opt/java1.5 # export PATH=$JAVA_HOME/bin:$PATH # > export LD_LIBRARY_PATH=/opt/java1.5/jre/lib/amd64 > # export LD_RUN_PATH=/opt/java1.5/jre/lib/amd64 > Created file /etc/ld.so.conf.d/java1.5 file contains > /opt/java1.5/jre/lib/amd64 > # ldconfig > # ldconfig -v | grep librxtx > librxtxParallel-2.1-7.so -> librxtxParallel.so > librxtxRaw-2.1-7.so -> librxtxRaw.so > librxtxSerial-2.1-7.so -> librxtxSerial.so > librxtxI2C-2.1-7.so -> librxtxI2C.so > librxtxRS485-2.1-7.so -> librxtxRS485.so #file > /opt/java1.5/jre/lib/amd64/librxtxSerial-2.1-7.so > librxtxSerial-2.1-7.so: ELF 64-bit LSB shared object, AMD x86-64, > version 1 (SYSV), not stripped # cd rxtx-2.1-7/contrib # java Test > /dev/cub00 opening the Port: /dev/ttyS0 > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 The native library loaded in this case. It appears no ports are enumerated. Perhaps you have not setup lockfiles? I suspect it will work as root. Its probably a permission issue of some sort. Have seen "R. How can I use Lock Files with rxtx?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL The user will need read and write permissions for the device file and must be in the proper group to create lockfiles as mentioned in the INSTALL document. > open Ports > Exception in thread "main" java.lang.NullPointerException > at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:800) > at Test.(Test.java:29) > at Test.main(Test.java:23) > > We have also tried JDK BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.1-1 > which throws java.lang.UnsatisfiedLinkError: Some JREs place the native libraries in other directories. I think I noticed IBM did it differently for instance. I'm not familiar with BEA's JRE. It should be the same directory that libjava.so is in. > JDK BEA JRockit(R) (build > R26.0.0-188-52875-1.5.0_04-20051110-0920-linux-x86_64) throws > java.lang.NullPointerException > Probably the same problem as above with lockfiles/permissions. -- Trent Jarvi tjarvi at qbang.org From Scott.Hughes at dalsemi.com Thu Mar 2 11:32:44 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 12:32:44 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Dmitry, Trent, et al, > > also I tested (very lightly) jnilib and it looks like it works too > > but extensive testing is still required > > (currently I have just keyspan adapter, but I don't have any device, > > so I just tested that rxtx recognizes serial port without errors) > > > > that installer contains universal library > > so in theory it should work on intel's Macintosh > > I have a MacBook Pro on order and when it arrives (in ~3 > weeks) I'll eagerly test your new library. Thanks for contributing > the unversial binary! As promised, I did test the universal binary (included in Trent's latest: 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works fine. I am having trouble getting it to run in non-sudo though, but I expect this is unrelated to the new architecture. I copied both the RXTXcomm.jar and librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the actions described in the "preinstall" script included with the source distribution. When I run my app which access the serial port (non-sudo'ed), I get: - - - - - - - - - - - - - - check_group_uucp(): error testing lock file creation Error details:Permission denied check_lock_status: No permission to create lock file. please see: How can I use Lock Files with rxtx? in INSTALL Experimental: JNI_OnLoad called. - - - - - - - - - - - - - - To double check: - - - - - - - - - - - - - - $ ls -al /var/lock total 0 drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. $ sudo niutil -readprop / /groups/uucp users shughes - - - - - - - - - - - - - - Which looks right to me. I did notice that the Readme.rtf in the source distribution suggests that this folder should be /var/spool/uucp, but I guess that's out of date. I bet I missed something obvious here. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From tjarvi at qbang.org Thu Mar 2 13:49:51 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 2 Mar 2006 13:49:51 -0700 (MST) Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Thu, 2 Mar 2006, Scott Hughes wrote: > > Dmitry, Trent, et al, > >>> also I tested (very lightly) jnilib and it looks like it works too >>> but extensive testing is still required >>> (currently I have just keyspan adapter, but I don't have any device, >>> so I just tested that rxtx recognizes serial port without errors) >>> >>> that installer contains universal library >>> so in theory it should work on intel's Macintosh >> >> I have a MacBook Pro on order and when it arrives (in ~3 >> weeks) I'll eagerly test your new library. Thanks for contributing >> the unversial binary! > > As promised, I did test the universal binary (included in Trent's latest: > 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a Keyspan > Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and it works > fine. > > I am having trouble getting it to run in non-sudo though, but I expect this > is unrelated to the new architecture. I copied both the RXTXcomm.jar and > librxtxSerial.jnilib into /System/Java/Extensions. Then I performed the > actions described in the "preinstall" script included with the source > distribution. When I run my app which access the serial port (non-sudo'ed), > I get: > > - - - - - - - - - - - - - - > check_group_uucp(): error testing lock file creation Error > details:Permission denied > check_lock_status: No permission to create lock file. > please see: How can I use Lock Files with rxtx? in INSTALL > Experimental: JNI_OnLoad called. > - - - - - - - - - - - - - - > > To double check: > > - - - - - - - - - - - - - - > $ ls -al /var/lock > total 0 > drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > > $ sudo niutil -readprop / /groups/uucp users > shughes > - - - - - - - - - - - - - - > > Which looks right to me. I did notice that the Readme.rtf in the source > distribution suggests that this folder should be /var/spool/uucp, but I > guess that's out of date. I bet I missed something obvious here. > Hi Scott That looks sane to me. The /var/spool/uucp is older and not used currently. We don't know whats 'right' actually but rxtx wants /var/lock right now. SerialImp.h #if defined(__APPLE__) # define DEVICEDIR "/dev/" /*# define LOCKDIR "/var/spool/uucp"*/ # define LOCKDIR "/var/lock" # define LOCKFILEPREFIX "LK." # define UUCP #endif /* __APPLE__ */ what is failinging the check is an attempt to create the file: /var/lock/tmpXXXXX Just to see if you have permission. SerialImp.c: testLockFile = fopen (testLockAbsFileName, "w+"); if (NULL == testLockFile) { report_error("check_group_uucp(): error testing lock file " "creation Error details:"); report_error(strerror(errno)); free(testLockAbsFileName); return 1; } fclose (testLockFile); unlink (testLockAbsFileName); What happens if you do the following as shughes: touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX Thats all the test is trying. Until that works, the test will fail. -- Trent Jarvi tjarvi at qbang.org From sean_montgomery at baseview.com Thu Mar 2 14:04:45 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 16:04:45 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: References: <1809DA15308DD51180EE00508BCF21942F811D90@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > On Thu, 2 Mar 2006, Scott Hughes wrote: > >> >> Dmitry, Trent, et al, >> >>>> also I tested (very lightly) jnilib and it looks like it works too >>>> but extensive testing is still required >>>> (currently I have just keyspan adapter, but I don't have any >>>> device, >>>> so I just tested that rxtx recognizes serial port without errors) >>>> >>>> that installer contains universal library >>>> so in theory it should work on intel's Macintosh >>> >>> I have a MacBook Pro on order and when it arrives (in ~3 >>> weeks) I'll eagerly test your new library. Thanks for contributing >>> the unversial binary! >> >> As promised, I did test the universal binary (included in Trent's >> latest: >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core Duo with a >> Keyspan >> Adapter (USA-19HS) and one of our Serial-to-1-Wire adapters... and >> it works >> fine. >> >> I am having trouble getting it to run in non-sudo though, but I >> expect this >> is unrelated to the new architecture. I copied both the >> RXTXcomm.jar and >> librxtxSerial.jnilib into /System/Java/Extensions. Then I >> performed the >> actions described in the "preinstall" script included with the source >> distribution. When I run my app which access the serial port (non- >> sudo'ed), >> I get: >> >> - - - - - - - - - - - - - - >> check_group_uucp(): error testing lock file creation Error >> details:Permission denied >> check_lock_status: No permission to create lock file. >> please see: How can I use Lock Files with rxtx? in INSTALL >> Experimental: JNI_OnLoad called. >> - - - - - - - - - - - - - - >> >> To double check: >> >> - - - - - - - - - - - - - - >> $ ls -al /var/lock >> total 0 >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >> >> $ sudo niutil -readprop / /groups/uucp users >> shughes >> - - - - - - - - - - - - - - >> >> Which looks right to me. I did notice that the Readme.rtf in the >> source >> distribution suggests that this folder should be /var/spool/uucp, >> but I >> guess that's out of date. I bet I missed something obvious here. >> > > Hi Scott > > That looks sane to me. The /var/spool/uucp is older and not used > currently. We don't know whats 'right' actually but rxtx wants / > var/lock right now. > > SerialImp.h > > #if defined(__APPLE__) > # define DEVICEDIR "/dev/" > /*# define LOCKDIR "/var/spool/uucp"*/ > # define LOCKDIR "/var/lock" > # define LOCKFILEPREFIX "LK." > # define UUCP > #endif /* __APPLE__ */ > > > what is failinging the check is an attempt to create the file: > > /var/lock/tmpXXXXX > > Just to see if you have permission. > > SerialImp.c: > > testLockFile = fopen (testLockAbsFileName, "w+"); > if (NULL == testLockFile) > { > report_error("check_group_uucp(): error testing > lock file " > "creation Error details:"); > report_error(strerror(errno)); > free(testLockAbsFileName); > return 1; > } > > fclose (testLockFile); > unlink (testLockAbsFileName); > > > > What happens if you do the following as shughes: > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > Thats all the test is trying. Until that works, the test will fail. FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on a 10.4.5 box (we're in the process of switching to 2.1.7) just a day or two ago. I tried both niutil and NetInfo Manager to add my user to the uucp group, but couldn't touch /var/spool/uucp/dummy and was getting very frustrated. Then I restarted the Mac, and presto, it worked. I don't remember having to restart when adding people to the uucp group in the past... I thought you only had to restart Windows boxes ;-) HTH, Sean From Scott.Hughes at dalsemi.com Thu Mar 2 14:57:56 2006 From: Scott.Hughes at dalsemi.com (Scott Hughes) Date: Thu, 2 Mar 2006 15:57:56 -0600 Subject: [Rxtx] universal binaries for Mac OS X Message-ID: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Sean Montgomery > Sent: Thursday, March 02, 2006 3:05 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] universal binaries for Mac OS X > > > On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: > > > On Thu, 2 Mar 2006, Scott Hughes wrote: > > > >> > >> Dmitry, Trent, et al, > >> > >>>> also I tested (very lightly) jnilib and it looks like it > works too > >>>> but extensive testing is still required > >>>> (currently I have just keyspan adapter, but I don't have any > >>>> device, > >>>> so I just tested that rxtx recognizes serial port without errors) > >>>> > >>>> that installer contains universal library > >>>> so in theory it should work on intel's Macintosh > >>> > >>> I have a MacBook Pro on order and when it arrives (in ~3 > >>> weeks) I'll eagerly test your new library. Thanks for > contributing > >>> the unversial binary! > >> > >> As promised, I did test the universal binary (included in Trent's > >> latest: > >> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core > Duo with a > >> Keyspan > >> Adapter (USA-19HS) and one of our Serial-to-1-Wire > adapters... and > >> it works > >> fine. > >> > >> I am having trouble getting it to run in non-sudo though, but I > >> expect this > >> is unrelated to the new architecture. I copied both the > >> RXTXcomm.jar and > >> librxtxSerial.jnilib into /System/Java/Extensions. Then I > >> performed the > >> actions described in the "preinstall" script included with > the source > >> distribution. When I run my app which access the serial > port (non- > >> sudo'ed), > >> I get: > >> > >> - - - - - - - - - - - - - - > >> check_group_uucp(): error testing lock file creation Error > >> details:Permission denied > >> check_lock_status: No permission to create lock file. > >> please see: How can I use Lock Files with rxtx? in INSTALL > >> Experimental: JNI_OnLoad called. > >> - - - - - - - - - - - - - - > >> > >> To double check: > >> > >> - - - - - - - - - - - - - - > >> $ ls -al /var/lock > >> total 0 > >> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . > >> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. > >> > >> $ sudo niutil -readprop / /groups/uucp users > >> shughes > >> - - - - - - - - - - - - - - > >> > >> Which looks right to me. I did notice that the Readme.rtf in the > >> source > >> distribution suggests that this folder should be /var/spool/uucp, > >> but I > >> guess that's out of date. I bet I missed something obvious here. > >> > > > > Hi Scott > > > > That looks sane to me. The /var/spool/uucp is older and not used > > currently. We don't know whats 'right' actually but rxtx wants / > > var/lock right now. > > > > SerialImp.h > > > > #if defined(__APPLE__) > > # define DEVICEDIR "/dev/" > > /*# define LOCKDIR "/var/spool/uucp"*/ > > # define LOCKDIR "/var/lock" > > # define LOCKFILEPREFIX "LK." > > # define UUCP > > #endif /* __APPLE__ */ > > > > > > what is failinging the check is an attempt to create the file: > > > > /var/lock/tmpXXXXX > > > > Just to see if you have permission. > > > > SerialImp.c: > > > > testLockFile = fopen (testLockAbsFileName, "w+"); > > if (NULL == testLockFile) > > { > > report_error("check_group_uucp(): error testing > > lock file " > > "creation Error details:"); > > report_error(strerror(errno)); > > free(testLockAbsFileName); > > return 1; > > } > > > > fclose (testLockFile); > > unlink (testLockAbsFileName); > > > > > > > > What happens if you do the following as shughes: > > > > touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX > > > > Thats all the test is trying. Until that works, the test will fail. > > FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on > a 10.4.5 > box (we're in the process of switching to 2.1.7) just a day or two > ago. I tried both niutil and NetInfo Manager to add my user to the > uucp group, but couldn't touch /var/spool/uucp/dummy and was getting > very frustrated. > > Then I restarted the Mac, and presto, it worked. I don't remember > having to restart when adding people to the uucp group in the > past... I thought you only had to restart Windows boxes ;-) > Restarting worked for me. I also don't remember having to do that before. There must be a "group-cache" of some sorts. It's nice to know I'm not the only one, but it'd be even nicer to figure out why it happens. Scott -- Scott Hughes - Engineer Shughes aht dalsemi daut com Maxim/Dallas Semiconductor From sean_montgomery at baseview.com Thu Mar 2 15:17:38 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Thu, 2 Mar 2006 17:17:38 -0500 Subject: [Rxtx] universal binaries for Mac OS X In-Reply-To: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> References: <1809DA15308DD51180EE00508BCF21942F812023@misnts1.dalsemi.com> Message-ID: On Mar 2, 2006, at 4:57 PM, Scott Hughes wrote: > > >> -----Original Message----- >> From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] >> On Behalf Of Sean Montgomery >> Sent: Thursday, March 02, 2006 3:05 PM >> To: RXTX Developers and Users >> Subject: Re: [Rxtx] universal binaries for Mac OS X >> >> >> On Mar 2, 2006, at 3:49 PM, Trent Jarvi wrote: >> >>> On Thu, 2 Mar 2006, Scott Hughes wrote: >>> >>>> >>>> Dmitry, Trent, et al, >>>> >>>>>> also I tested (very lightly) jnilib and it looks like it >> works too >>>>>> but extensive testing is still required >>>>>> (currently I have just keyspan adapter, but I don't have any >>>>>> device, >>>>>> so I just tested that rxtx recognizes serial port without errors) >>>>>> >>>>>> that installer contains universal library >>>>>> so in theory it should work on intel's Macintosh >>>>> >>>>> I have a MacBook Pro on order and when it arrives (in ~3 >>>>> weeks) I'll eagerly test your new library. Thanks for >> contributing >>>>> the unversial binary! >>>> >>>> As promised, I did test the universal binary (included in Trent's >>>> latest: >>>> 2.1-7r2) for Mac OS X on my MacBook Pro with Intel Core >> Duo with a >>>> Keyspan >>>> Adapter (USA-19HS) and one of our Serial-to-1-Wire >> adapters... and >>>> it works >>>> fine. >>>> >>>> I am having trouble getting it to run in non-sudo though, but I >>>> expect this >>>> is unrelated to the new architecture. I copied both the >>>> RXTXcomm.jar and >>>> librxtxSerial.jnilib into /System/Java/Extensions. Then I >>>> performed the >>>> actions described in the "preinstall" script included with >> the source >>>> distribution. When I run my app which access the serial >> port (non- >>>> sudo'ed), >>>> I get: >>>> >>>> - - - - - - - - - - - - - - >>>> check_group_uucp(): error testing lock file creation Error >>>> details:Permission denied >>>> check_lock_status: No permission to create lock file. >>>> please see: How can I use Lock Files with rxtx? in INSTALL >>>> Experimental: JNI_OnLoad called. >>>> - - - - - - - - - - - - - - >>>> >>>> To double check: >>>> >>>> - - - - - - - - - - - - - - >>>> $ ls -al /var/lock >>>> total 0 >>>> drwxrwxr-x 2 root uucp 68 Mar 2 12:13 . >>>> drwxr-xr-x 24 root wheel 816 Mar 2 12:09 .. >>>> >>>> $ sudo niutil -readprop / /groups/uucp users >>>> shughes >>>> - - - - - - - - - - - - - - >>>> >>>> Which looks right to me. I did notice that the Readme.rtf in the >>>> source >>>> distribution suggests that this folder should be /var/spool/uucp, >>>> but I >>>> guess that's out of date. I bet I missed something obvious here. >>>> >>> >>> Hi Scott >>> >>> That looks sane to me. The /var/spool/uucp is older and not used >>> currently. We don't know whats 'right' actually but rxtx wants / >>> var/lock right now. >>> >>> SerialImp.h >>> >>> #if defined(__APPLE__) >>> # define DEVICEDIR "/dev/" >>> /*# define LOCKDIR "/var/spool/uucp"*/ >>> # define LOCKDIR "/var/lock" >>> # define LOCKFILEPREFIX "LK." >>> # define UUCP >>> #endif /* __APPLE__ */ >>> >>> >>> what is failinging the check is an attempt to create the file: >>> >>> /var/lock/tmpXXXXX >>> >>> Just to see if you have permission. >>> >>> SerialImp.c: >>> >>> testLockFile = fopen (testLockAbsFileName, "w+"); >>> if (NULL == testLockFile) >>> { >>> report_error("check_group_uucp(): error testing >>> lock file " >>> "creation Error details:"); >>> report_error(strerror(errno)); >>> free(testLockAbsFileName); >>> return 1; >>> } >>> >>> fclose (testLockFile); >>> unlink (testLockAbsFileName); >>> >>> >>> >>> What happens if you do the following as shughes: >>> >>> touch /var/lock/tmpXXXXX && rm -f /var/lock/tmpXXXXX >>> >>> Thats all the test is trying. Until that works, the test will fail. >> >> FWIW, I installed RXTX 2.0-7 (which uses /var/spool/uucp) on >> a 10.4.5 >> box (we're in the process of switching to 2.1.7) just a day or two >> ago. I tried both niutil and NetInfo Manager to add my user to the >> uucp group, but couldn't touch /var/spool/uucp/dummy and was getting >> very frustrated. >> >> Then I restarted the Mac, and presto, it worked. I don't remember >> having to restart when adding people to the uucp group in the >> past... I thought you only had to restart Windows boxes ;-) >> > > Restarting worked for me. I also don't remember having to do that > before. > There must be a "group-cache" of some sorts. It's nice to know I'm > not the > only one, but it'd be even nicer to figure out why it happens. > I'm glad to hear it worked. I wonder if it's because of the access control list (ACL) support Apple's got in OS X 10.4.x... From lunareclipse03 at web.de Fri Mar 3 14:49:24 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Fri, 03 Mar 2006 22:49:24 +0100 Subject: [Rxtx] Question about Parallel Port programming Message-ID: <689774291@web.de> Hi everybody, I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody enlighten me? Trent??!? Hope that you are out there... :-) Kind regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From tjarvi at qbang.org Fri Mar 3 15:02:12 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 3 Mar 2006 15:02:12 -0700 (MST) Subject: [Rxtx] Question about Parallel Port programming In-Reply-To: <689774291@web.de> References: <689774291@web.de> Message-ID: On Fri, 3 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody, > > I get a strange error when I want to write some bytes of data to a Parallel Port using the CreateFile, GetCommState and WriteFile API's > on Win32. CreateFile gives me a correct file handle for e.g. LPT1:, but GetCommState always returns error 87 via GetLastError(). > Why is this? I'm calling GetCommState right after opening the port, so why is it failing? Furthermore, if I don't use GetCommState or SetCommState, > a call to WriteFile for the opened parallel port hangs my program. It never comes out of the WriteFile call again. Why is this? Can anybody > enlighten me? Trent??!? Hope that you are out there... :-) > Hi Sven I've not tried the printer code in rxtx for a while. It should work with a printer. My only testing was done with an epson DX10 daisy wheel. Thats a circa AppleIIC printer. I suspect you tried something besides a printer and are now trying to find other ways to make it work. LPT1 means you are using the printer drivers for the parallel port in the w32 API. I suspect you are trying to do something like sending bits to homemade hardware. The "Printer" is not online so the w32 API is probably not able to query or write to the port using printer kernel drivers. You could avoid the W32 API calls and write to addresses with inb/outb mentioned earlier on the list to bitbang with something connected to the Parallel port or you could figure out how to suggest to the port your 'printer' is online by figuring out which pin needs to be +5V/... so you can use the w32 API. What happens if you plug a real printer in and turn it on for instance? I suspect the w32 API will be happy. -- Trent Jarvi tjarvi at qbang.org From muthuramantripura at gmail.com Sat Mar 4 03:53:33 2006 From: muthuramantripura at gmail.com (Muthuraman S) Date: Sat, 4 Mar 2006 16:23:33 +0530 Subject: [Rxtx] about jdk Message-ID: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Hi all, I want to use IBM's jdk1.5.Will I have to pay money to IBM if i download it?Can I use it with RXTx.I am new to Linux also.Can anyone please tell me which are all the jdk's i can use free of cost and which are all the jdk's that support javax.comm with rxtx. Thanks . From tjarvi at qbang.org Sat Mar 4 07:23:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 07:23:57 -0700 (MST) Subject: [Rxtx] about jdk In-Reply-To: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> References: <5f7fe9fe0603040253l4529ce22j3d3431e0a9d876e9@mail.gmail.com> Message-ID: On Sat, 4 Mar 2006, Muthuraman S wrote: > Hi all, > I want to use IBM's jdk1.5.Will I have to pay money to IBM if i > download it?Can I use it with RXTx.I am new to Linux also.Can anyone > please tell me which are all the jdk's i can use free of cost and > which are all the jdk's that support javax.comm with rxtx. > rxtx should work with any of the JDKs. We have not tested them all though. There may be bugs in rxtx that will be found and can be fixed. There are probably more general news groups to help you with your generic JDK cost questions. Such discussions quickly turn into nonproductive noise I'd rather not see here. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 07:54:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 15:54:09 +0100 Subject: [Rxtx] Re: Parallel Port programming question Message-ID: <690561338@web.de> Hi everybody and Trent, yes, you are right: I'm using a homemade relay card interface on the parallel port. I want to switch on/off the relays. Can you tell me which pins I have to wire together to make the W32API "happy" and operating so that calls to WriteFile succeed? Would be a great help. I already connected Pin11 to ground. Thanks in advance, --Sven Sven Ahlemann ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 From tjarvi at qbang.org Sat Mar 4 08:36:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 08:36:32 -0700 (MST) Subject: [Rxtx] Re: Parallel Port programming question In-Reply-To: <690561338@web.de> References: <690561338@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi everybody and Trent, > > yes, you are right: I'm using a homemade relay card interface on the > parallel port. I want to switch on/off the relays. Can you tell me which > pins I have to wire together to make the W32API "happy" and operating so > that calls to WriteFile succeed? Would be a great help. I already > connected Pin11 to ground. > Hi Sven I have a book here called "Parallel Port Complete" by Jan Axelson. Its a Visual Basic oriented book (though if you do the C API, you can see what they are doing just fine). It is ISBN 096508191-5. http://www.lvr.com/parprtib.htm You will end up reading these pages too. http://www.logix4u.cjb.net/ They do basic bit banging but it appears to be much like the inb() outb() mentioned for simple circuits. For the type of stuff you want, they use programmable microcontrollers. 82(C)55 with 74LS245 bus tranceivers and 74LS244 Buffer/drivers and a couple 74LS14's. The 82(C)55 spec sheets may well have examples. This should all fit on one breadboard. All their examples ground pins 18-24. I suspect you need more logic with pins 1 and 10-17 to use the WriteFile as intended. You can probably request that a local book store get a copy of the above on the shelves and then look through it. I think the book will help you a great deal. They have working circuits, working vb code and explanations of everything in detail. From there you should be able to get working circuits, test them and then move to the C api or even rxtx. It is a little more complicated than serial programming but the chips used are not undoable for hobby use. I'd be interested in hearing how it goes. That said, I've not tried this with parallel ports. The examples I saw that are more doable hit specific addresses without WriteFile(). -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sat Mar 4 11:48:27 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Sat, 04 Mar 2006 19:48:27 +0100 Subject: [Rxtx] Parallel Port Programming question [SOLVED] Message-ID: <690756897@web.de> Hi all, hi Trent, I solved my parallel port relay interface card problem in conjunction with the Win32 WriteFileAPI the following way: Whenever I wanted to do a WriteFile call to LPT1:, the program didn't come out of the WriteFile function anymore. I noticed that it could probably a "PaperOut" and/or "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to GND. That's it. Now a call to WriteFile doesn't hang any longer, and the relays are switched in the correct way. Anyhow, I have to thank you all for your time and especially you, Trent, for a tip on Jan Axelsson's ParallelPortComplete-Book. I think I'll order a copy. Best regards from Germany, Sven Ahlemann ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130 From rene at mayrhofer.eu.org Fri Mar 3 06:21:22 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Fri, 3 Mar 2006 13:21:22 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC Message-ID: <200603031321.26384.rene@mayrhofer.eu.org> Dear all, For a research project dealing with USB-serial devices, we are currently working also with PocketPC. The current rxtx upstream version (2.1-7) did not work, at least for our devices, so I fixed it. Attached is a patch (only a few lines of diff code, the larger part in it is the update of the VisualC++ project file....) that: - updates the project file and the code to compile with VisualC++ Embedded 4.0 (which is, as far as I know, free to use). - fixes a problem with the returned serial port handles. They can in fact be negative on the Java side, because they use the full unsigned int range. Therefore one check for negative values must be disabled. - fixes the native drain method to work on the recent PocketPC devices. - adds a few more debug print statements in the native code that I needed to track down the last two items. I hope to have done the changes correctly, and have verified that it works with PocketPC. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: rxtx-2.1-7-wince.diff.bz2 Type: application/x-bzip2 Size: 6560 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/rxtx-2.1-7-wince.diff-0011.bz2 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060303/46542eb6/attachment-0011.bin From evv95 at yahoo.com.br Sat Mar 4 07:51:24 2006 From: evv95 at yahoo.com.br (Everton Vidal Vieira) Date: Sat, 4 Mar 2006 14:51:24 +0000 (GMT) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: Message-ID: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Hello everybody, I am trying to find the mail archive of the RXTX discussion list. Is there any archive? The reason I am asking you is to avoid to post a well know question... But I will post it any, sorry if it's a repead issue. This is my problem - I have donwloaded a RXTX version for PocketPC - My intent is to use this library to access the IRDA port that is mapped to a COM port - I have compiled a sample app to list the available ports and send some data. - When the COM4 port is close to another device, the communication begins but I receive a message like: "The security account database contains an internal inconsistency" I am really a newbie when dealing with IRDA. In fact, I think that when working directly with the port, I have a RAW IRDA, without the IRDA stack. Maybe, this is the problem. Anyway, has anyone ever faced this kind of issue? Some java forums tell to use the CEJavaComm (TEILO) that I cannot find it anywhere. Thanks, Everton Vidal Vieira Curitiba-Pr, Brasil __________________________________________________ Fa?a liga??es para outros computadores com o novo Yahoo! Messenger http://br.beta.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060304/2c1d625c/attachment-0011.html From dave at fuuz.com Sat Mar 4 17:57:46 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 00:57:46 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Hi list, I'm sorry to burst onto the list with such a request, but I'm very new to RXTX and have spent the last few days getting horribly confused. I would be forever grateful if someone could help me out. The situation is this: I have a Gumstix development platform (which is a PXA255 xscale arm chip). I have a closed source java app which needs to sit on it. They have an "arm" version of RXTX bundled with the serial communications module... i can see by just looking inside the JAR that they are including the serial and parallel .so files. However, the problem arises becuase my platform only has uclib on it and not libc. When the RXTX library gets called, libc.so.6 complains. This library however is not on the development platform. So, I thought, the simplest solution is simply to recompile the SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix toolchain) and whack the resulant libraries into the jar and hope everythign is well again. Not so simple. I downloaded 2.0-7, as I believe that is the one that still uses sun's implementation and not gnu.io, which is what the closed source app is expecting. If i'm honest, the problem is I'm hopelessly lost in the makefiles, and even when i tried just compiling by hand "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors - mostly due to needing RXTXPort.h which doesn't seem to be part of the package I downloaded. If anyone can take pity and see their way to helping me with a uclib version of the two shared libraries, or even just some words of wisdom, i would be eternally grateful. Thanks again for taking the time to read. Best Regards, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/d2be9f40/attachment-0002.html From tjarvi at qbang.org Sat Mar 4 18:11:22 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 18:11:22 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> References: <1963271.16221141520266447.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build ../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build ../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:05:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:05:46 -0700 (MST) Subject: [Rxtx] About RXTX, IRDA and PocketPC In-Reply-To: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> References: <20060304145124.98844.qmail@web36506.mail.mud.yahoo.com> Message-ID: On Sat, 4 Mar 2006, Everton Vidal Vieira wrote: > Hello everybody, > > I am trying to find the mail archive of the RXTX discussion list. Is > there any archive? http://mailman.qbang.org/pipermail/rxtx/ general info is in the signature. > > The reason I am asking you is to avoid to post a well know question... > But I will post it any, sorry if it's a repead issue. > > This is my problem > - I have donwloaded a RXTX version for PocketPC > - My intent is to use this library to access the IRDA port that is > mapped to a COM port > - I have compiled a sample app to list the available ports and send > some data. > - When the COM4 port is close to another device, the communication > begins but I receive a message like: > "The security account database contains an internal inconsistency" Hmm. Not sure about that. > > > I am really a newbie when dealing with IRDA. In fact, I think that when > working directly with the port, I have a RAW IRDA, without the IRDA > stack. Maybe, this is the problem. Anyway, has anyone ever faced this > kind of issue? In linux, there is a "comm" layer (termios) used for IRDA. > > Some java forums tell to use the CEJavaComm (TEILO) that I cannot find > it anywhere. > > Thanks, > > Everton Vidal Vieira > Curitiba-Pr, Brasil > > This is all WinCE, right? You may look at the archive for today. I see a patch was submitted for pocketPC. I'm not very familiar with the builds but it appears that may be a good start. This did work long ago. IRDA is new so may have problems but could work and it looks like someone is using it. Sadly neither of you are subscribed to the list but perhaps you can find each other's emails from the archives. Perhaps others here have input regarding your project also. I think the WinCE code Michal Hobbit submitted long ago is very close to what you need and is working for others as mentioned. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:08:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:08:23 -0700 (MST) Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: <200603031321.26384.rene@mayrhofer.eu.org> References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: On Fri, 3 Mar 2006, Rene Mayrhofer wrote: > Dear all, > > For a research project dealing with USB-serial devices, we are currently > working also with PocketPC. The current rxtx upstream version (2.1-7) did not > work, at least for our devices, so I fixed it. Attached is a patch (only a > few lines of diff code, the larger part in it is the update of the VisualC++ > project file....) that: > - updates the project file and the code to compile with VisualC++ Embedded 4.0 > (which is, as far as I know, free to use). > - fixes a problem with the returned serial port handles. They can in fact be > negative on the Java side, because they use the full unsigned int range. > Therefore one check for negative values must be disabled. > - fixes the native drain method to work on the recent PocketPC devices. > - adds a few more debug print statements in the native code that I needed to > track down the last two items. > > I hope to have done the changes correctly, and have verified that it works > with PocketPC. > > with best regards, > Rene > > Thanks Rene Have you tried this with IRDA ports? There was a related question today. http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html [Rxtx] About RXTX, IRDA and PocketPC -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:27:35 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:27:35 -0700 (MST) Subject: [Rxtx] Parallel Port Programming question [SOLVED] In-Reply-To: <690756897@web.de> References: <690756897@web.de> Message-ID: On Sat, 4 Mar 2006 lunareclipse03 at web.de wrote: > Hi all, hi Trent, > > I solved my parallel port relay interface card problem in conjunction > with the Win32 WriteFileAPI the following way: Whenever I wanted to do a > WriteFile call to LPT1:, the program didn't come out of the WriteFile > function anymore. I noticed that it could probably a "PaperOut" and/or > "BUSY" issue, and so I connected Pins 11 and 12 (BUSY and PAPER OUT) to > GND. That's it. Now a call to WriteFile doesn't hang any longer, and the > relays are switched in the correct way. Anyhow, I have to thank you all > for your time and especially you, Trent, for a tip on Jan Axelsson's > ParallelPortComplete-Book. I think I'll order a copy. > Hi Sven This will be interesting for others trying to do parallel port programming. I get questions from hobby people about every 3 months. Could you provide an asci diagram or discription of your final wiring so other hobbyists can get their own ideas going? I'll include it with rxtx if you don't mind. It will save them the headache you went through as well as me :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Mar 4 19:30:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 4 Mar 2006 19:30:50 -0700 (MST) Subject: [Rxtx] Any logj users? Message-ID: I have a Suse Linux user off the list that is trying to get logj working. This is for interacting with HAM radios. I'm sure people are using it but I don't have equipment to see whats going on. He is fairly green to Java. Would anyone with a working logj system be interested in helping him get logj working? I've gone about as far as I can but don't know exactly what to look for. -- Trent Jarvi tjarvi at qbang.org From dave at fuuz.com Sun Mar 5 05:43:56 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 12:43:56 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Thanks for coming to the rescue Trent. Much appreciated. Unfortunately i'm still a little unclear about a few things :-( 1. I don't actaully want to install RXTX into my host environment at all - i just want to build it. I had a quick look through the makefile and it looks to me like it always does the install stage. Indeed, when I ran the build process, I was prompted to move some files for while I needed root (and when I said no, the process quit..). This rang a few alarm bells, as surely if i'm just building in a directory I shouldnt need any kind of root privelidge. 2. My cross compilation tool is a little bit interesting. It's a buildroot from gumstix, as as far as I can work out, when you make the buildroot a toolchain is set up. This compiles a new compiler called arm-linux-gcc which seems to have all the uclib include paths set somehow. If you run "arm-linux-gcc" some magic things happen: dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions Thread model: posix gcc version 3.4.2 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" #include "..." search starts here: #include <...> search starts here: /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include End of search list. GNU C version 3.4.2 (arm-linux-uclibc) compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o So I believe that sets up all the right parameters and optimizations... Unless i've very much misunderstood it, I think I need a way of compiling the java headers (the javah bit of the makefile) and then I need to compile SerialImp and ParallelImp and then link them into two shared libraries? Does that any kind of sense!? If so, unfortunately I think it only helps to prove how far out of my depth I am lol. Any additional words of wisdom very much apreciated. Best Regards, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: Sun 05 Mar 2006 01:11:22 BST Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Hi list, > > I'm sorry to burst onto the list with such a request, but I'm very new > to RXTX and have spent the last few days getting horribly confused. I > would be forever grateful if someone could help me out. > > The situation is this: I have a Gumstix development platform (which is a > PXA255 xscale arm chip). I have a closed source java app which needs to > sit on it. They have an "arm" version of RXTX bundled with the serial > communications module... i can see by just looking inside the JAR that > they are including the serial and parallel .so files. > > However, the problem arises becuase my platform only has uclib on it and > not libc. When the RXTX library gets called, libc.so.6 complains. This > library however is not on the development platform. > > So, I thought, the simplest solution is simply to recompile the > SerialImp and ParallelImp with my arm/uclibc compiler (part of a gumstix > toolchain) and whack the resulant libraries into the jar and hope > everythign is well again. > > Not so simple. I downloaded 2.0-7, as I believe that is the one that > still uses sun's implementation and not gnu.io, which is what the closed > source app is expecting. If i'm honest, the problem is I'm hopelessly > lost in the makefiles, and even when i tried just compiling by hand > "arm-linux-gcc SerialImp.c -o SerialImp.obj" there are screens of errors > - mostly due to needing RXTXPort.h which doesn't seem to be part of the > package I downloaded. > > If anyone can take pity and see their way to helping me with a uclib > version of the two shared libraries, or even just some words of wisdom, > i would be eternally grateful. > RXTXPort.h and the related include files are generated by javah. After you have compiled the jar and javah has created the include files on a native platform, should be able to copy the files over. It should be possible to 'just build' the package. Make sure the cross tools are in the front of your path cd rxtx-2.0-7 mkdir build && cd build .../configure --target=arm-linux-gcc make Note that the makefile has an @ character in the javah line which hides that noisy portion of the build. You can delete the @. After removing the @ from a native build for say i686 linux, you can run make in a script file and just use that to build your uclibc library. cd rxtx-2.0-7 mkdir build && cd build .../configure script make exit Then typescript will have all the commands you need. You can use your crosstools instead then and pass -marm-linux-gcc to gcc (or however you do it). I think once you generate your include files, the rest will make sense. It should work though I have not yet done uclibc myself. -- Trent Jarvi tjarvi at qbang.org _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sun Mar 5 14:34:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 14:34:26 -0700 (MST) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help In-Reply-To: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> References: <10287502.16401141562636316.JavaMail.root@hera.intranet.fuuz.com> Message-ID: On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From rene at mayrhofer.eu.org Sun Mar 5 15:29:15 2006 From: rene at mayrhofer.eu.org (Rene Mayrhofer) Date: Sun, 5 Mar 2006 22:29:15 +0000 Subject: [Rxtx] Patch for making the WinCE port compile with VisualC++ Embedded 4.0, fix error under PocketPC In-Reply-To: References: <200603031321.26384.rene@mayrhofer.eu.org> Message-ID: <200603052229.22399.rene@mayrhofer.eu.org> Am Sunday 05 March 2006 02:08 schrieb Trent Jarvi: > Have you tried this with IRDA ports? There was a related question today. > > http://mailman.qbang.org/pipermail/rxtx/20060304/thread.html > [Rxtx] About RXTX, IRDA and PocketPC No, sorry - I haven't yet had a need to access the IRDA ports from Java. I can just tell that accessing the virtual Bluetooth ports is problematic at least with the recent Asus MyPal devices. Since we don't use them either right now, I haven't bothered to track it down though. with best regards, Rene -- ---------------------------- http://www.mayrhofer.eu.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060305/3f5afefd/attachment-0011.bin From dave at fuuz.com Sun Mar 5 16:04:30 2006 From: dave at fuuz.com (Dave Bath) Date: Sun, 5 Mar 2006 23:04:30 +0000 (GMT) Subject: [Rxtx] ARM uclib gumstix - A Desperate plea for help Message-ID: <28955424.16631141599870760.JavaMail.root@hera.intranet.fuuz.com> Hi Trent, Thanks for the info! I don't think i have quite the ability to get quite so down and dirty with the makefiles at the moment, but good to know i'm on the right lines. I guess the biggest problem for me is in this particular case I also have a further problem. I have to make the libaries fit into an existing jar which i have no source for. I know it has been compiled using javax.comm and not gnu.io... and due to the way the overall system is distributed (it's an OSGi framework) this has to stay packaged up inside the jar. So what I need is a uclibc compiled version of the shared libraries, but ones which use javax.comm. I can only hope that the work to make RXTX compile easily for uclib (or produce some binaries) goes quickly! Failing that, a quick and dirty script for compiling just the C libraries for various target platforms would probably help a lot too. Anyway, thanks for the reply. Best, Dave ----- Original Message ----- From: Trent Jarvi To: RXTX Developers and Users Sent: 05 March 2006 21:34:26 Subject: Re: [Rxtx] ARM uclib gumstix - A Desperate plea for help On Sun, 5 Mar 2006, Dave Bath wrote: > Thanks for coming to the rescue Trent. > > Much appreciated. Harldy to the rescue but I really want uclibc to work. I know thats the direction for everything from gumstix to cell phones. > > Unfortunately i'm still a little unclear about a few things :-( > > 1. I don't actaully want to install RXTX into my host environment at all > - i just want to build it. I had a quick look through the makefile and > it looks to me like it always does the install stage. Indeed, when I > ran the build process, I was prompted to move some files for while I > needed root (and when I said no, the process quit..). This rang a few > alarm bells, as surely if i'm just building in a directory I shouldnt > need any kind of root privelidge. Ya. Just do that part. Or edit the makefile. The reason that is there is support for linux is not easy. Someone can run "make install" and it solves 90% of the support issues. I guess we need to clean that out. But 2.0-6 is history. Sun has offered to resolve some issues and we will provide 2.0-8 with many fixes like that when they deliver. We have been doing this for 9 years and nobody has complained about security. Your direction is a bit different and we need to accommodate that in the future. > > 2. My cross compilation tool is a little bit interesting. It's a > buildroot from gumstix, as as far as I can work out, when you make the > buildroot a toolchain is set up. This compiles a new compiler called > arm-linux-gcc which seems to have all the uclib include paths set > somehow. If you run "arm-linux-gcc" some magic things happen: > > dave at dave64:~/project/gumstix-buildroot/toolchain_build_arm_nofpu/rxtx-2.0-7pre1/src$ arm-linux-gcc -v test.c -o test.obj > Reading specs from /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs > Configured with: /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions : (reconfigured) /home/dave/project/gumstix-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --with-float=soft --enable-sjlj-exceptions > Thread model: posix > gcc version 3.4.2 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/cc1 -quiet -v -D__ARM_ARCH_3__ test.c -quiet -dumpbase test.c -msoft-float -auxbase test -version -o /tmp/ccs2SZBK.s > ignoring nonexistent directory "/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/include > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/sys-include > End of search list. > GNU C version 3.4.2 (arm-linux-uclibc) > compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9). > GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129559 > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/bin/as -mfpu=softfpa -mfpu=softfpa -o /tmp/cceIBmpn.o /tmp/ccs2SZBK.s > /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/libexec/gcc/arm-linux-uclibc/3.4.2/collect2 --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test.obj /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crt1.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crti.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/crtbegin.o -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2 -L/home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib /tmp/cceIBmpn.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-! uclibc/3.4.2/crtend.o /home/dave/project/gumstix-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/../../../../arm-linux-uclibc/lib/crtn.o > > > So I believe that sets up all the right parameters and optimizations... > > Unless i've very much misunderstood it, I think I need a way of > compiling the java headers (the javah bit of the makefile) and then I > need to compile SerialImp and ParallelImp and then link them into two > shared libraries? nods. It isnt as complicated as one would think. See the Makefile. You can hack it to work or just make a script. > > Does that any kind of sense!? If so, unfortunately I think it only helps > to prove how far out of my depth I am lol. sure. I want to actually provide uclibc binaries in the future and what you are doing is not unlike what I will have to do. You are just ahead of the curve. > > Any additional words of wisdom very much apreciated. Build rxtx on your native system and follow the koolaid. Let it do its thing. Understand that and catch it in a script. You should be able to get a binary in a couple hours. CC in the makefile will be arm-linux-gcc. a symbolic link or env variable will get you going there. -- Trent Jarvi tjarvi at qbang.org From lunareclipse03 at web.de Sun Mar 5 16:17:09 2006 From: lunareclipse03 at web.de (lunareclipse03@web.de) Date: Mon, 06 Mar 2006 00:17:09 +0100 Subject: [Rxtx] Parallel Port interface card wiring diagram Message-ID: <691898768@web.de> Hello everybody, hello Trent, included is a basic wiring diagram of an attached relay card interface. I know it's not perfect, but I think it should be precise enough to show the wiring of the parallel port interface. I would be very happy if it would be included in the RXTX package. (Shame on me, it was made with Notepad... :-) Best regards from Germany, --Sven Ahlemann -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ParallelPort-WiringDiagram.txt Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/9e2c3835/ParallelPort-WiringDiagram-0002.txt From tjarvi at qbang.org Sun Mar 5 16:44:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 5 Mar 2006 16:44:13 -0700 (MST) Subject: [Rxtx] Parallel Port interface card wiring diagram In-Reply-To: <691898768@web.de> References: <691898768@web.de> Message-ID: On Mon, 6 Mar 2006 lunareclipse03 at web.de wrote: > Hello everybody, hello Trent, > > included is a basic wiring diagram of an attached relay card interface. > I know it's not perfect, but I think it should be precise enough to show > the wiring of the parallel port interface. > I would be very happy if it would be included in the RXTX package. > (Shame on me, it was made with Notepad... :-) > > Best regards from Germany, Thanks Sven As usual I spent this weekend answering 90% personal emails and 10% list emails. RXTX is hobby stuff for me. Even though I'm probably going to Boston to do it for a company. I'll say more later. Its really good stuff for the project. What is really missing is the wiki. I should just not answer email for a week and do the wiki. Or maybe someone else would like to do it? -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sun Mar 5 17:19:41 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 01:19:41 +0100 Subject: [Rxtx] RXTX on Windows. Message-ID: I would use RXTX as open alternative of Sun Java Comm API implemantation in Windows XP enviroment. Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or rxtx-2.0-7pre1. In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put RXTXcomm.jarin lib AND/OR ext (Which it is that right one?) directory and *.dll in bin directory. I also changed javax.comm.properties file with: Driver=gnu.io.RXTXCommDriver My working program (perfectly working with Sun implementation) say me: Java lib Version = RXTX-2.0-7pre1 java.io.IOException: Serial port "COM14" does not exist (available serial ports are: ) at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) and this code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } don't produce any output. I have tried also version rxtx-2.1-7-bins-r2 (gnu.io namespace). With this version the above code: Enumeration enum = CommPortIdentifier.getPortIdentifiers(); while ( enum.hasMoreElements() ) { CommPortIdentifier cpi = (CommPortIdentifier) enum.nextElement (); System.out.println( cpi.getName() ); } write this: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! If I try to use uno of this port (COM14 USB-to-serial port), after 3 minutes of waiting time I have: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) I remark. My program (a GPS program) works well with SUN Api. I must lose every hope and continue to use SUN Implementation? Thank, Gianni Antini Firenze - ITALY -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/ecd052fe/attachment-0002.html From jvermillard at archean.fr Mon Mar 6 03:11:44 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 11:11:44 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing Message-ID: <1141639904.7167.3.camel@localhost.localdomain> Hi, I just installed a PCI serial card (RS422/485). I loaded the linux kernel module driver, made the /dev/ nodes, looks fine but RXTX see only my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. dmesg extract : "Found Korenix JetCard 1402" "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" Any idea ? Juilen From s.tomaselli at jdialer.net Mon Mar 6 03:35:15 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 11:35:15 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: Message-ID: <440C1063.5020308@jdialer.net> Did you change the import line in your .java file? PS Nice to see another Italian here :-D Gianni Antini ha scritto: > I would use RXTX as open alternative of Sun Java Comm API implemantation > in Windows XP enviroment. > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > rxtx-2.0-7pre1. > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > and *.dll in bin directory. > I also changed javax.comm.properties file with: > > Driver=gnu.io.RXTXCommDriver > > My working program (perfectly working with Sun implementation) say me: > > Java lib Version = RXTX-2.0-7pre1 > java.io.IOException: Serial port "COM14" does not exist (available > serial ports are: ) > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java:54) > > and this code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > don't produce any output. > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > namespace). With this version the above code: > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > while ( enum.hasMoreElements() ) { > CommPortIdentifier cpi = (CommPortIdentifier) > enum.nextElement(); > System.out.println( cpi.getName() ); > } > > write this: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available ports!!!!! > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > minutes of waiting time I have: > > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > > I remark. My program (a GPS program) works well with SUN Api. > I must lose every hope and continue to use SUN Implementation? > > Thank, > Gianni Antini > Firenze - ITALY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/78b65f0d/s.tomaselli-0011.vcf From s.tomaselli at jdialer.net Mon Mar 6 04:36:33 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Mon, 06 Mar 2006 12:36:33 +0100 Subject: [Rxtx] Lniux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141639904.7167.3.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> Message-ID: <440C1EC1.7050000@jdialer.net> i had your same problem. i used setserial to assign an irq to a serial port. ttyJ0 isn't a serial port. serial ports are ttyS Julien Vermillard ha scritto: > Hi, > > I just installed a PCI serial card (RS422/485). I loaded the linux > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > dmesg extract : > "Found Korenix JetCard 1402" > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > Any idea ? > > Juilen > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 148 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/b9533c3f/s.tomaselli-0011.vcf From g.antini at gmail.com Mon Mar 6 04:37:56 2006 From: g.antini at gmail.com (Gianni Antini) Date: Mon, 6 Mar 2006 12:37:56 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C1063.5020308@jdialer.net> References: <440C1063.5020308@jdialer.net> Message-ID: Yes of course. I changed the import line ONLY using rxtx-2-1-7. Since the rxtx-2.0-7pre1 version is a SUN API implementation I think that is not necessary. Right? Gianni PS Viva l'italia!!! ;-) On 3/6/06, Salvo Tomaselli wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.(SerialConnection.java > :54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 (gnu.io > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java > :415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/937d4f6d/attachment-0011.html From jvermillard at archean.fr Mon Mar 6 07:15:28 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 15:15:28 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <440C1EC1.7050000@jdialer.net> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> Message-ID: <1141654528.7167.8.camel@localhost.localdomain> Very strange, it looks like real ports for me : /dev # setserial /dev/ttyJ0 /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 /dev # setserial /dev/ttyJ1 /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > i had your same problem. > i used setserial to assign an irq to a serial port. > ttyJ0 isn't a serial port. > serial ports are ttyS > > Julien Vermillard ha scritto: > > Hi, > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > dmesg extract : > > "Found Korenix JetCard 1402" > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > From j.a.horsmeier at wanadoo.nl Mon Mar 6 08:14:24 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Mon, 6 Mar 2006 16:14:24 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: <691898768@web.de> Message-ID: Greetings, compared to Sun's comm package, rxtx is a great improvement which helped us a lot: rxtx's performance is just great; it's stability on our platforms is more than perfect. We achieve fast response times (using long shielded cables) in extremely hazardous areas (also electro-magnetic distortion-wise speaking). Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion are no problem at all. If you want a peek at what we're using the rxtx package for, have a look at http://www.dadid.com (select "latest product" at the left of the page). @Trent Jarvi: Thanks a bunch for this fine package; keep up the good work and, kind regards, Jos From jvermillard at archean.fr Mon Mar 6 08:54:00 2006 From: jvermillard at archean.fr (Julien Vermillard) Date: Mon, 06 Mar 2006 16:54:00 +0100 Subject: [Rxtx] Linux, installed an extra PCI serial port card, but RXTX see nothing In-Reply-To: <1141654528.7167.8.camel@localhost.localdomain> References: <1141639904.7167.3.camel@localhost.localdomain> <440C1EC1.7050000@jdialer.net> <1141654528.7167.8.camel@localhost.localdomain> Message-ID: <1141660440.7167.17.camel@localhost.localdomain> After more test, I linked /dev/ttyS2 to /dev/ttyJ0 and /dev/ttyS3 to /dev/ttyJ1. RXTX seen the port, opened it, but apparently, nothing on the communication line. After shutdown of my java application the port look like blocked, impossible to "echo test >/dev/ttyS2" the command is blocking ! Look like more a serial device driver problem, than an RXTX problem. Julien Le lundi 06 mars 2006 ? 15:15 +0100, Julien Vermillard a ?crit : > Very strange, it looks like real ports for me : > > /dev # setserial /dev/ttyJ0 > /dev/ttyJ0, UART: 16950/954, Port: 0xdc00, IRQ: 11 > /dev # setserial /dev/ttyJ1 > /dev/ttyJ1, UART: 16950/954, Port: 0xdc08, IRQ: 11 > > > Le lundi 06 mars 2006 ? 12:36 +0100, Salvo Tomaselli a ?crit : > > i had your same problem. > > i used setserial to assign an irq to a serial port. > > ttyJ0 isn't a serial port. > > serial ports are ttyS > > > > Julien Vermillard ha scritto: > > > Hi, > > > > > > I just installed a PCI serial card (RS422/485). I loaded the linux > > > kernel module driver, made the /dev/ nodes, looks fine but RXTX see only > > > my /dev/ttyS0 & /dev/ttyS1 RS232 ports and not the new ones. > > > > > > dmesg extract : > > > "Found Korenix JetCard 1402" > > > "ttyJ0 at I/O 0xdc00 (irq = 11) is a 16C950/954" > > > "ttyJ1 at I/O 0xdc08 (irq = 11) is a 16C950/954" > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From f.frumento at ngi.it Mon Mar 6 10:06:44 2006 From: f.frumento at ngi.it (Fabio Frumento) Date: Mon, 06 Mar 2006 18:06:44 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> Message-ID: <440C6C24.80609@ngi.it> Hi Gianni, did you clean the JRE/JDK installation files before installing the Rxtx libraries instead of the sun ones ? i fear you could have some problem with your application loading the sun jar and the Rxtx libs... you should work with 2.1.7r2 it is the most recent and supported version of Rxtx let me know. Bye! Fabio Gianni Antini ha scritto: > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > that is not necessary. Right? > > Gianni > > PS > Viva l'italia!!! ;-) > > On 3/6/06, *Salvo Tomaselli* > wrote: > > Did you change the import line in your .java file? > > PS > Nice to see another Italian here :-D > > Gianni Antini ha scritto: > > I would use RXTX as open alternative of Sun Java Comm API > implemantation > > in Windows XP enviroment. > > Unfortunately I have some problem when use either > rxtx-2.1-7-bins-r2 or > > rxtx-2.0-7pre1. > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > directory > > and *.dll in bin directory. > > I also changed javax.comm.properties file with: > > > > Driver=gnu.io.RXTXCommDriver > > > > My working program (perfectly working with Sun implementation) > say me: > > > > Java lib Version = RXTX-2.0-7pre1 > > java.io.IOException: Serial port "COM14" does not exist (available > > serial ports are: ) > > at cz.darmovzalt.comm.SerialConnection.( > SerialConnection.java:54) > > > > and this code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > don't produce any output. > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > namespace). With this version the above code: > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > while ( enum.hasMoreElements() ) { > > CommPortIdentifier cpi = (CommPortIdentifier) > > enum.nextElement(); > > System.out.println( cpi.getName() ); > > } > > > > write this: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > ports!!!!! > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > minutes of waiting time I have: > > > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > (StreamDecoder.java:415) > > at > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > I remark. My program (a GPS program) works well with SUN Api. > > I must lose every hope and continue to use SUN Implementation? > > > > Thank, > > Gianni Antini > > Firenze - ITALY > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > >------------------------------------------------------------------------ > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Mon Mar 6 12:25:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 6 Mar 2006 12:25:31 -0700 (MST) Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: References: Message-ID: On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > Greetings, > > compared to Sun's comm package, rxtx is a great improvement which helped us > a lot: rxtx's performance is just great; it's stability on our platforms is > more than perfect. We achieve fast response times (using long shielded > cables) > in extremely hazardous areas (also electro-magnetic distortion-wise > speaking). > Communication speeds up to 38400 Baud including RS/232<-->RS/485 conversion > are no problem at all. > > If you want a peek at what we're using the rxtx package for, have a look > at http://www.dadid.com (select "latest product" at the left of the page). > > @Trent Jarvi: > Thanks a bunch for this fine package; keep up the good work and, > > Hi Jos wow. half duplex. rs485. Thats *huge* huge huge. huge. Think automobile assembly line huge. Would you share with us how you do the rs232/rs485 in hardware? Thats the only way to do it from my software end. It just needs hardware. And you did it. Amazing. May I put you in http://www.rxtx.org/projects.html ? Wow. Thats.. huge. :) -- Trent Jarvi tjarvi at qbang.org From nuaimat2002 at yahoo.com Mon Mar 6 14:33:54 2006 From: nuaimat2002 at yahoo.com (Mohammad H Nuaimat) Date: Mon, 6 Mar 2006 13:33:54 -0800 (PST) Subject: [Rxtx] Need to know the basics Message-ID: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> hi everybody i am a new to serial programming ... i am a senior IT student , i will graduate by the end of this semister i am developing an application which will use java & oracle & php i assume that the "Java" part of my project will be responsible of dealing with SMS. i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual modem/serial port ) , i can connect my phone to PC also by using a DKU-2 cable i know some AT Commands , i've got the whole AT Commands Set from nokia i am using Windows XP-SP2 can anyone help me in a code or anything that .. sends an sms from the PC to customer , through the n6260 connected ?? and read sms and process the sm text , then respond to the customer again i try AT+CMGS it works fine in HyperTerminal of Windows XP any suggestions are welcome --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/2b642e19/attachment-0011.html From t.delenikas at gmail.com Mon Mar 6 14:49:47 2006 From: t.delenikas at gmail.com (Thanasis Delenikas) Date: Mon, 6 Mar 2006 23:49:47 +0200 Subject: [Rxtx] Need to know the basics In-Reply-To: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> References: <20060306213354.29909.qmail@web33105.mail.mud.yahoo.com> Message-ID: Hi Mohammad, As far as the SMS part, you may wish to take a look at my project: http://jsmsengine.org which is also powered by RxTx for most platforms. Regards, Thanasis. On 3/6/06, Mohammad H Nuaimat wrote: > > hi everybody > > i am a new to serial programming ... > i am a senior IT student , i will graduate by the end of this semister > i am developing an application which will use java & oracle & php > > i assume that the "Java" part of my project will be responsible of dealing > with SMS. > > i have a nokia 6260 phone , connected to my PC through Bluetooth (Virtual > modem/serial port ) , i can connect my phone to PC also by using a DKU-2 > cable > > i know some AT Commands , i've got the whole AT Commands Set from nokia > i am using Windows XP-SP2 > can anyone help me in a code or anything that .. > sends an sms from the PC to customer , through the n6260 connected ?? > and read sms and process the sm text , then respond to the customer again > > i try AT+CMGS it works fine in HyperTerminal of Windows XP > > > > > any suggestions are welcome > > > ------------------------------ > Yahoo! Mail > Bring photos to life! New PhotoMail > makes > sharing a breeze. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060306/1c9f206e/attachment-0011.html From j.a.horsmeier at wanadoo.nl Tue Mar 7 02:06:16 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Tue, 7 Mar 2006 10:06:16 +0100 Subject: [Rxtx] Just a short note from a happy user. In-Reply-To: Message-ID: > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org]On Behalf Of > Trent Jarvi > Sent: Monday, March 06, 2006 8:26 PM > To: RXTX Developers and Users > Subject: Re: [Rxtx] Just a short note from a happy user. > > On Mon, 6 Mar 2006, Jos A. Horsmeier wrote: > > > Greetings, > > > > compared to Sun's comm package, rxtx is a great improvement > which helped us > > a lot: rxtx's performance is just great; it's stability on our > platforms is > > more than perfect. We achieve fast response times (using long shielded > > cables) > > in extremely hazardous areas (also electro-magnetic distortion-wise > > speaking). > > Communication speeds up to 38400 Baud including > RS/232<-->RS/485 conversion > > are no problem at all. > > > > If you want a peek at what we're using the rxtx package for, have a look > > at http://www.dadid.com (select "latest product" at the left of > the page). > > > > @Trent Jarvi: > > Thanks a bunch for this fine package; keep up the good work and, > Hi Jos > > wow. half duplex. rs485. Thats *huge* > > huge huge. huge. > > Think automobile assembly line huge. One of our customers uses our system for colour checking of their plastic granulate (plastic, but it looks like sugar). The stuff has to be colourless. Another customer checks the colour, gloss and structure for their artificial leather dashboards; we even have a customer checking the 'purity' of egg white. > Would you share with us how you do the rs232/rs485 in hardware? I'm not the hardware guy, but here goes: we use a little voltage converter (12V rs/232 level to/from 5V TTL level), together with another little Atmel controller that simply does 'whatever comes in goes out'. After each negative edge it starts a timer; when the timer runs out, the A/B lines are set from 'transmit' mode to a tri-state mode, which implies 'receive mode'. The timer runs at 2 milli second intervals which means that the rs485 lines stay in 'transmit' mode for that time period after a complete message has been sent. This deals with long cable lengths. The controlling PC and the other communication end communicate using a variation of the 'modbus' protocol; this implies that when the PC doesn't query the other end, the other end won't send anything back. > Thats the only way to do it from my software end. It just needs hardware. > > And you did it. Amazing. To much honour your honour ;-) > May I put you in http://www.rxtx.org/projects.html ? Sure, why not; I feel flattered. kind regards, Jos From marice at knology.net Wed Mar 8 08:51:06 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 09:51:06 -0600 Subject: [Rxtx] Problem on Mac OS X Message-ID: I'm trying to port an application that uses the javax.comm package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException when I call CommPortIdentifier.open(); the exception message is "Unknown Application". The Keyspan diags say the port is OK and available. I am able to enumerate the ports using CommPortIdentifier.getPortIdentifiers(). The port names I get are: /dev/cu.KeySerial1 /dev/tty.KeySerail1 The code below is a snip from the application: CommPortIdentifier idPort = null; Enumeration enumPorts; boolean bPortFound; enumPorts = CommPortIdentifier.getPortIdentifiers(); bPortFound = false; while((enumPorts.hasMoreElements()) && (bPortFound == false)) { idPort = (CommPortIdentifier)enumPorts.nextElement(); if(idPort.getName().equals(portName)) { bPortFound = true; } } try { // Open the port portGPS = (SerialPort)idPort.open("GPSInterface", 2000); try { // Get an input stream for reading from the port streamInput = portGPS.getInputStream(); try { // Add this object as a port listener portGPS.addEventListener(this); portGPS.notifyOnDataAvailable(true); try { // Set the communications parameters portGPS.setSerialPortParams (dataRate,dataBits,stopBits,parity); } catch(UnsupportedCommOperationException eUnsupported) { System.out.println("Unsupported comm parameters: " + eUnsupported.getMessage()); } } catch(TooManyListenersException eTooMany) { System.out.println("Too many listeners on comm port: " + eTooMany.getMessage()); } } catch(IOException eIO) { System.out.println("GPS port input stream exception: " + eIO.getMessage()); } } catch(PortInUseException eInUse) { System.out.println("GPS port in use by another application: " + eInUse.getMessage()); } From tjarvi at qbang.org Wed Mar 8 11:18:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: On Wed, 8 Mar 2006, Michael Rice wrote: > I'm trying to port an application that uses the javax.comm package to OS X > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > RXTX 2.1-7r2. I always get a PortInUseException when I call > CommPortIdentifier.open(); the exception message is "Unknown Application". > The Keyspan diags say the port is OK and available. > > I am able to enumerate the ports using > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > /dev/cu.KeySerial1 > /dev/tty.KeySerail1 > The "Unknown Application" must be the locking code failing. The intent is so say which application has the port locked but the code is a stub for that. Did you make sure you setup the lockfiles? Also some have noted when you add a user to group lock, it does not work until they rebooted. I assume thats something to do with security on the Mac like SELinux on Linux. You will get the "Unknown Application" when there is a lockfile already there that cannot be removed due to permissions or perhaps some other program is still using the port (maybe even your Keyspan diags). Perhaps you jumped to and from privileged user status and a lockfile remains? -- Trent Jarvi tjarvi at qbang.org From marice at knology.net Wed Mar 8 17:42:00 2006 From: marice at knology.net (Michael Rice) Date: Wed, 8 Mar 2006 18:42:00 -0600 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > On Wed, 8 Mar 2006, Michael Rice wrote: > >> I'm trying to port an application that uses the javax.comm package >> to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, >> Java 1.4.2_09, and RXTX 2.1-7r2. I always get a PortInUseException >> when I call CommPortIdentifier.open(); the exception message is >> "Unknown Application". The Keyspan diags say the port is OK and >> available. >> >> I am able to enumerate the ports using >> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >> /dev/cu.KeySerial1 >> /dev/tty.KeySerail1 >> > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a > lockfile remains? > > -- > Trent Jarvi > tjarvi at qbang.org Thanks, that was it. I had not created the /var/lock directory. It's all working fine now. Michael From colin at exsoft.com.au Wed Mar 8 16:10:46 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 09:10:46 +1000 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: Message-ID: <20060308230916.M39893@exsoft.com.au> Michael, The port in use exception comes because of the lock directory. The old RXTX version used the /var/spool/uucp directory for the lock files,where the new library uses /var/lock. You need to create the directory, make sure you are in group uucp and it has group write permissions. For some strange reason you also need to delete any left over lock files in the previous /var/spool/uucp directory, perhaps something in the code is not paying attention to the #define? Colin -- Colin Canfield Business Analyst Explorative Software Pty Ltd 0412 197 943 colin at exsoft.com.au ---------- Original Message ----------- From: Trent Jarvi To: RXTX Developers and Users Sent: Wed, 8 Mar 2006 11:18:34 -0700 (MST) Subject: Re: [Rxtx] Problem on Mac OS X > On Wed, 8 Mar 2006, Michael Rice wrote: > > > I'm trying to port an application that uses the javax.comm package to OS X > > 10.4.5. I'm using a Keyspan USA-19HS USB->Serial adapter, Java 1.4.2_09, and > > RXTX 2.1-7r2. I always get a PortInUseException when I call > > CommPortIdentifier.open(); the exception message is "Unknown Application". > > The Keyspan diags say the port is OK and available. > > > > I am able to enumerate the ports using > > CommPortIdentifier.getPortIdentifiers(). The port names I get are: > > /dev/cu.KeySerial1 > > /dev/tty.KeySerail1 > > > > The "Unknown Application" must be the locking code failing. The > intent is so say which application has the port locked but the code > is a stub for that. Did you make sure you setup the lockfiles? > Also some have noted when you add a user to group lock, it does not > work until they rebooted. I assume thats something to do with > security on the Mac like SELinux on Linux. > > You will get the "Unknown Application" when there is a lockfile > already there that cannot be removed due to permissions or perhaps > some other program is still using the port (maybe even your Keyspan > diags). > > Perhaps you jumped to and from privileged user status and a lockfile > remains? > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx ------- End of Original Message ------- From dmarkman at mac.com Thu Mar 9 01:16:24 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:16:24 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: I'm wondering On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Thu Mar 9 01:20:00 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 03:20:00 -0500 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> Message-ID: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> please ignore my previous email so I'm wondering, did you use installer from the latest rxtx.org tarball? I'm asking because that installer contains the script that should set all folders and create /var/lock folder: #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; thanks On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > > On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: > >> On Wed, 8 Mar 2006, Michael Rice wrote: >> >>> I'm trying to port an application that uses the javax.comm >>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>> PortInUseException when I call CommPortIdentifier.open(); the >>> exception message is "Unknown Application". The Keyspan diags say >>> the port is OK and available. >>> >>> I am able to enumerate the ports using >>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>> /dev/cu.KeySerial1 >>> /dev/tty.KeySerail1 >>> >> >> The "Unknown Application" must be the locking code failing. The >> intent is so say which application has the port locked but the >> code is a stub for that. Did you make sure you setup the >> lockfiles? Also some have noted when you add a user to group >> lock, it does not work until they rebooted. I assume thats >> something to do with security on the Mac like SELinux on Linux. >> >> You will get the "Unknown Application" when there is a lockfile >> already there that cannot be removed due to permissions or perhaps >> some other program is still using the port (maybe even your >> Keyspan diags). >> >> Perhaps you jumped to and from privileged user status and a >> lockfile remains? >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > Thanks, that was it. I had not created the /var/lock directory. > It's all working fine now. > > Michael > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From colin at exsoft.com.au Thu Mar 9 04:43:06 2006 From: colin at exsoft.com.au (Colin Canfield) Date: Thu, 9 Mar 2006 22:43:06 +1100 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: I installed from the R2 binary distribution; it wasn't until later I went back looked at the source distro and realised about the installer.... Colin On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > please ignore my previous email > so > I'm wondering, did you use installer from the latest rxtx.org tarball? > > I'm asking because that installer contains the script that should > set all folders > and create /var/lock folder: > > #!/bin/sh > curruser=`sudo id -p | grep 'login' | sed 's/login.//'` > echo $curruser > > if [ ! -d /var/lock ] > then > sudo mkdir /var/lock > fi > > sudo chgrp uucp /var/lock > sudo chmod 775 /var/lock > if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > > /dev/null` ] > then > sudo niutil -mergeprop / /groups/uucp users $curruser > fi > exit 0; > > thanks > > On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: > >> >> On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >> >>> On Wed, 8 Mar 2006, Michael Rice wrote: >>> >>>> I'm trying to port an application that uses the javax.comm >>>> package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>> adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>> PortInUseException when I call CommPortIdentifier.open(); the >>>> exception message is "Unknown Application". The Keyspan diags >>>> say the port is OK and available. >>>> >>>> I am able to enumerate the ports using >>>> CommPortIdentifier.getPortIdentifiers(). The port names I get are: >>>> /dev/cu.KeySerial1 >>>> /dev/tty.KeySerail1 >>>> >>> >>> The "Unknown Application" must be the locking code failing. The >>> intent is so say which application has the port locked but the >>> code is a stub for that. Did you make sure you setup the >>> lockfiles? Also some have noted when you add a user to group >>> lock, it does not work until they rebooted. I assume thats >>> something to do with security on the Mac like SELinux on Linux. >>> >>> You will get the "Unknown Application" when there is a lockfile >>> already there that cannot be removed due to permissions or >>> perhaps some other program is still using the port (maybe even >>> your Keyspan diags). >>> >>> Perhaps you jumped to and from privileged user status and a >>> lockfile remains? >>> >>> -- >>> Trent Jarvi >>> tjarvi at qbang.org >> >> Thanks, that was it. I had not created the /var/lock directory. >> It's all working fine now. >> >> Michael >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From lyon at docjava.com Thu Mar 9 06:43:28 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 09 Mar 2006 08:43:28 -0500 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: Hi All, The assumption that the /var/lock folder is in place is based on the assumption that the user remembered to run the installer. My guess is that users will either not read the readme or forget that an installer needs to be run. If we really want to make sure that the installer was run, perhaps we should check. On a mac, typically, /var/lock is not present. So, we could do a: File f = new File("/var/lock"); if (!f.exists()) initLockError(); ... Perhaps a number of platforms would fail if the /var/lock directory was not present. And the question of how to fix such an error remains open. My simple minded approach would be to ask the user to run the shell script. On the other hand, wouldn't it be nice if Java could create the needed files? How about something like this: public class UnixCommands { public static void main(String[] args) { checkUnixPermission(); } public static void checkUnixPermission() { if (!isRxtxConfigured()) { In.message( "user is not in uucp and lock groups.\n" + "To fix this access problem use:\n" + "sudo usermod -G uucp,lock "); } } public static boolean isRxtxConfigured() { String s[] = groups(); return StringUtils.contains(s[0], "uucp") && StringUtils.contains(s[0], "lock"); } public static String[] groups() { String command = "groups "; try { return OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } return null; } public static void print(Object o[]) { for (int i = 0; i < o.length; i++) { System.out.println(o[i]); } } public static void tarXvf(File f) { String command = "tar " + " -xf " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } public static void chmodPlusX(File f) { String command = "chmod " + " +x " + f.getAbsolutePath(); try { OsUtils.executeCommand(command); } catch (IOException e) { e.printStackTrace(); } } } With: public class OsUtils { /** * Runs through the list of known operating systems * @return true if the operating system is known. */ public static boolean isOsKnown() { if (isLinux()) return true; if (isMacOs()) return true; if (isWindows()) return true; return isSolaris(); } /** * this is an experimental method that is supposed * to compute the load on the CPU for the last 15 minutes. * Making this cross-platform is not easy and I don't know * what to do about windows. * @return the load (what are the units?) */ public static double get15MinuteLoad() { if (!isOsKnown()) return -1; // what is this OS? if (isWindows()) return -1; //windows has no implemention, yet. if (isMacOs()) { try { String[] strings = executeCommand("uptime"); PrintUtils.print(strings); return get15MinuteLoad(strings[0]); } catch (IOException e) { e.printStackTrace(); } } return -1; } /** * Input is returned by the uptime command. Typically: 09:34:56 up 15 * days, 35 min, 2 users, load average: 0.01, 0.04, 0.10 The last * number is the one of interest, showing the past 15 minutes of load. * The last number changes position, based on OS! * * @param s * @return 15 minutes load. */ private static double get15MinuteLoad(String s) { System.out.println("15 minutes load:" + s); int i = s.lastIndexOf(' '); String ss = s.substring(i); if (isMacOs()) { return Double.parseDouble(ss); } if (isLinux()) { return Double.parseDouble(ss); } System.out.println("os not implemented for get15MinuteLoad"); System.out.println("s=" + s); print(s.split(" ")); return -1; } /** * A method for printing an array of strings. * @param strings */ public static void print(String[] strings) { for (int i = 0; i < strings.length; i++) System.out.println(i + ":" + strings[i]); } /** * A what to get the properties os.name * @return the os.name */ public static String getOsName() { Properties prop = System.getProperties(); return prop.getProperty("os.name"); } /** * * @return true if it is a mac. */ public static boolean isMacOs() { final String prefix = "mac"; return isOsPrefix(prefix); } /** * * @return true if it is linux */ public static boolean isLinux() { return isOsPrefix("linux"); } /** * * @return true if it is net bsd */ public static boolean isNetBsd() { return isOsPrefix("NetBSD"); } /** * * @return true if it is freebsd */ public static boolean isFreeBsd() { return isOsPrefix("FreeBSD"); } /** * * @return true if it is solais or sunos */ public static boolean isSolaris() { return isOsPrefix("SunOS") || isOsPrefix("Solaris"); } public static boolean isWindowsNt() { return isWindows("nt"); } public static boolean isWindows2000() { return isWindows("2000"); } public static boolean isWindows98() { return isWindows("98"); } public static boolean isWindows95() { return isWindows("95"); } public static boolean isWindowsXp() { return isWindows("xp"); } public static boolean isWindows(String str) { if (isWindows()) { String os = getOsName().toLowerCase(); if (os.indexOf(str) > -1) return true; } return false; } public static boolean isWindows() { return isOsPrefix("win"); } /** * Execute a command on the local OS * * @param com * @return an array of string for output from the command. * @throws java.io.IOException */ public static String[] executeCommand(String com) throws java.io.IOException { System.out.println("Exec:" + com); Runtime rt = Runtime.getRuntime(); Vector v = new Vector(); Process p = rt.exec(com); BufferedReader br = new BufferedReader(new InputStreamReader( p.getErrorStream())); String s; v.addElement("-----errorStream------"); while ((s = br.readLine()) != null) v.addElement(s); readInputStream(p, v); String sa[] = new String[v.size()]; v.copyInto(sa); return sa; } private static void readInputStream(Process p, Vector v) throws IOException { BufferedReader br; String s; br = new BufferedReader(new InputStreamReader(p.getInputStream())); v.addElement("-------inputStream------"); while ((s = br.readLine()) != null) v.addElement(s); } public static boolean isOsPrefix(final String prefix) { String os = getOsName(); return os != null && os.toLowerCase().startsWith(prefix); } public static void testListProperties() { final Toolkit tk = Toolkit.getDefaultToolkit(); final String propertyName = //"win.propNames"; ""; String propnames[] = (String[]) tk .getDesktopProperty(propertyName); System.out.println("Supported windows property names:"); for (int i = 0; i < propnames.length; i++) { System.out.println(propnames[i]); } } public static void main(String[] args) { System.out.println("isWindows:" + isWindows()); } } And: public class StringUtils { public static char NEW_LINE = 0x0A; public static String NEW_LINE_STRING = "" + 0x0A; public static StringBuffer LowerCaseFirstLetter( String s) { StringBuffer sb = new StringBuffer(s); char c = sb.charAt(0); sb.setCharAt(0, Character.toLowerCase(c)); return sb; } /** * Replace all instances of the oldChar with the * newChar and create a new string; * * @param s the old string is unchanged * @param oldChar the old char to search for * @param newChar the new char to replace it with * @return a new string that is the same size as the old string */ public static String replaceChar(String s, char oldChar, char newChar) { char ca[] = s.toCharArray(); for (int i = 0; i < ca.length; i++) { if (ca[i] == oldChar) ca[i] = newChar; } return new String(ca); } public static String removeChar(String s, char oldChar) { return StringUtils.replaceAll(s, oldChar + "", ""); } public static String sub(String line, String stringToEliminate, String replacementString) { int ssSize = stringToEliminate.length(); int i = line.indexOf(stringToEliminate); if (i < 0) return line; return line.substring(0, i) + replacementString + line.substring(i + ssSize); } public static String replaceFirstInstance( String inputString, String searchString, String replacementString) { int i = inputString.indexOf(searchString); if (i == -1) return inputString; int ssSize = searchString.length(); String part1 = inputString.substring(0, i); String part2 = inputString.substring( i + ssSize); return part1 + replacementString + part2; } /** * replaceAll * * @param s input String * @param searchString The string to searchFor * @param replaceString The string to replace * it with * @return new string */ public static String replaceAll(String s, String searchString, String replaceString) { int i = s.indexOf(searchString); if (i == -1) return s; int ssSize = searchString.length(); while (i != -1) { String part1 = s.substring(0, i); String part2 = s.substring( i + ssSize); s = part1 + replaceString + part2; i = s.indexOf(searchString, i + replaceString.length()); } return s; } public static void main(String args[]) { final String testString = "new\nline"; hexDump(testString); hexDump(replaceChar(testString, '\n', '#')); } public static void hexDump(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(Integer.toHexString(c[i]) + '\t' + c[i] + '\n'); } } /** * Replace all occurances of the searchString * in the inputString with the replaceString * * @param inputString left unmolested * @param searchString an array of strings to search for * @param replaceString the new string to replace them with * @return a new string a brand new string */ public static String replaceAll(String inputString, String searchString[], String replaceString) { for (int i = 0; i < searchString.length; i++) inputString = replaceAll(inputString, searchString[i], replaceString ); return inputString; } public static void testBug() { String s = "c:\\test"; s = replaceAll(s, "\\", "/"); System.out.println(s); } public static void testReplace() { String ss[] = {"if", "then", "static"}; String s = "public static public static if if then static"; s = replaceAll(s, ss, ""); System.out.println(s); } /** * Determine how many tokens are in a string * * @param l The string to be processed * @return the number of tokens */ public static int addTokens(String l) { System.out.println(l); int sum = 0; StringTokenizer st = new StringTokenizer(l, ", \t\r\f\n\"\\;"); int tc = st.countTokens(); System.out.println("tc=" + tc); for (int i = 0; i < tc; i++) { String s = st.nextToken(); int j = 0; try { j = Integer.parseInt(s); } catch (NumberFormatException e) { In.message(e); } System.out.println(j); sum = sum + j; } return sum; } /** * Method replaceAll. * * @return String */ public static String replaceAllSb(String s, String orig, String dest) { StringBuffer sb = new StringBuffer(); int pos = 0, lastpos; do { lastpos = pos; pos = s.indexOf(orig, pos); if (pos == -1) continue; sb.append(s.substring(lastpos, pos)); sb.append(dest); pos += orig.length(); } while (pos != -1); sb.append(s.substring(lastpos)); return sb.toString(); } public static char getFirstChar(String s) { char ca[] = s.toCharArray(); return ca[0]; } public static int getNumberOfDigits(String s) { char c[] = s.toCharArray(); int nod = 0; for (int i = 0; i < c.length; i++) if (Character.isDigit(c[i])) nod++; return nod; } /** * @param s1 * @param s2 * @return true if s1.contains(s2) */ public static boolean contains(String s1, String s2) { return s1.indexOf(s2) > -1; } public static String stripSuffix(String s, String suffix) { if (!s.endsWith(suffix)) return s; int i = s.lastIndexOf(suffix); return s.substring(0, i); } public static String[] getStringsThatEndWith(String list[], String end) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].endsWith(end)) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } public static String[] getStringsThatContain(String[] list, String contain) { Vector v = new Vector(); for (int i = 0; i < list.length; i++) { if (list[i].indexOf(contain) != -1) v.add(list[i]); } String s[] = new String[v.size()]; v.copyInto(s); return s; } } >I installed from the R2 binary distribution; it wasn't until later I >went back looked at the source distro and realised about the >installer.... > >Colin > > >On 09/03/2006, at 7:20 PM, Dmitry Markman wrote: > >>please ignore my previous email >>so >>I'm wondering, did you use installer from the latest rxtx.org tarball? >> >>I'm asking because that installer contains the script that should >>set all folders >>and create /var/lock folder: >> >>#!/bin/sh >>curruser=`sudo id -p | grep 'login' | sed 's/login.//'` >>echo $curruser >> >>if [ ! -d /var/lock ] >>then >>sudo mkdir /var/lock >>fi >> >>sudo chgrp uucp /var/lock >>sudo chmod 775 /var/lock >>if [ ! `sudo niutil -readprop / /groups/uucp users | grep >>$curruser > /dev/null` ] >>then >>sudo niutil -mergeprop / /groups/uucp users $curruser >>fi >>exit 0; >> >>thanks >> >>On Mar 8, 2006, at 7:42 PM, Michael Rice wrote: >> >>> >>>On Mar 8, 2006, at 12:18 PM, Trent Jarvi wrote: >>> >>>>On Wed, 8 Mar 2006, Michael Rice wrote: >>>> >>>>>I'm trying to port an application that uses the javax.comm >>>>>package to OS X 10.4.5. I'm using a Keyspan USA-19HS USB->Serial >>>>>adapter, Java 1.4.2_09, and RXTX 2.1-7r2. I always get a >>>>>PortInUseException when I call CommPortIdentifier.open(); the >>>>>exception message is "Unknown Application". The Keyspan diags >>>>>say the port is OK and available. >>>>> >>>>>I am able to enumerate the ports using >>>>>CommPortIdentifier.getPortIdentifiers(). The port names I get >>>>>are: >>>>>/dev/cu.KeySerial1 >>>>>/dev/tty.KeySerail1 >>>>> >>>> >>>>The "Unknown Application" must be the locking code failing. The >>>>intent is so say which application has the port locked but the >>>>code is a stub for that. Did you make sure you setup the >>>>lockfiles? Also some have noted when you add a user to group >>>>lock, it does not work until they rebooted. I assume thats >>>>something to do with security on the Mac like SELinux on Linux. >>>> >>>>You will get the "Unknown Application" when there is a lockfile >>>>already there that cannot be removed due to permissions or >>>>perhaps some other program is still using the port (maybe even >>>>your Keyspan diags). >>>> >>>>Perhaps you jumped to and from privileged user status and a >>>>lockfile remains? >>>> >>>>-- >>>>Trent Jarvi >>>>tjarvi at qbang.org >>> >>>Thanks, that was it. I had not created the /var/lock directory. >>>It's all working fine now. >>> >>>Michael >>>_______________________________________________ >>>Rxtx mailing list >>>Rxtx at qbang.org >>>http://mailman.qbang.org/mailman/listinfo/rxtx >> >>Dmitry Markman >> >>_______________________________________________ >>Rxtx mailing list >>Rxtx at qbang.org >>http://mailman.qbang.org/mailman/listinfo/rxtx >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From Bob_Jacobsen at lbl.gov Thu Mar 9 08:59:24 2006 From: Bob_Jacobsen at lbl.gov (Bob Jacobsen) Date: Thu, 9 Mar 2006 07:59:24 -0800 Subject: [Rxtx] Problem on Mac OS X In-Reply-To: <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: In the long run, it might be better to move RXTX on Mac OS X to use the underlying OS locking mechanism, instead of lock files. The serial port stack in Mac OS X has an option to perform the arbitration inside the driver stack. The note on locking from the code is (see http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): // Note that open() follows POSIX semantics: multiple open() calls to the same file will succeed // unless the TIOCEXCL ioctl is issued. This will prevent additional opens except by root-owned // processes. // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. if (ioctl(fileDescriptor, TIOCEXCL) == -1) So the locking can all be accomplished by an ioctl instead of making lock files. (Thanks for David Falkenburg for originally pointing this out to me) Unfortunately, I'm not sufficiently experienced to actually make this code change & rebuild RXTX. Bob -- Bob_Jacobsen at lbl.gov +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG From tjarvi at qbang.org Thu Mar 9 10:25:43 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 10:25:43 -0700 (MST) Subject: [Rxtx] Problem on Mac OS X In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: On Thu, 9 Mar 2006, Bob Jacobsen wrote: > In the long run, it might be better to move RXTX on Mac OS X to use the > underlying OS locking mechanism, instead of lock files. > > The serial port stack in Mac OS X has an option to perform the arbitration > inside the driver stack. The note on locking from the code is (see > http://developer.apple.com/samplecode/SerialPortSample/SerialPortSample.html): > > // Note that open() follows POSIX semantics: multiple open() calls to the > same file will succeed > // unless the TIOCEXCL ioctl is issued. This will prevent additional > opens except by root-owned > // processes. > // See tty(4) ("man 4 tty") and ioctl(2) ("man 2 ioctl") for details. > > if (ioctl(fileDescriptor, TIOCEXCL) == -1) > > So the locking can all be accomplished by an ioctl instead of making lock > files. (Thanks for David Falkenburg for originally pointing this out to me) > Unfortunately, I'm not sufficiently experienced to actually make this code > change & rebuild RXTX. > Thanks Bob The only drawback is user 0 would not respect this locking resulting in potential data loss for applications. This should be documented at a minimum.. Another minor gripe is the 'locking' is done after the port is taken but only nanoseconds later. When in Rome, do as the Romans do. This appears to be how Mac OS X wants to do it. RXTX should respect the underlying OS conventions. The ioctl is standard and could be used for all Unix systems to further avoid probems. Lockfiles are still standard on other Unix systems and should be followed. As I've mentioned to the list before, there isn't a real standard covering all lockfiles though. Each OS is a little different. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 9 13:02:41 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 9 Mar 2006 13:02:41 -0700 (MST) Subject: [Rxtx] I'm Joining Mathworks! Message-ID: The following will not change anything with regards to the rxtx project. As the maintainer of the project I want to disclose that working with rxtx is now a part of a position I have accepted. I have accepted a position at Mathworks as an Instrument Control Engineer. This position will involve working with current rxtx 2.1 and fixing bugs found in part. To avoid confusion, I will only post to the list from a Mathworks email address while speaking from this position as another happy contributor and user. At all other times, I'll be speaking for myself as usual. The fixes will continue to go into rxtx 2.0 when this becomes possible once more. This will be an exciting change for me. I will be able to focus more on things I enjoy including rxtx. I expect this will be a great thing for the ongoing LGPL rxtx project too. As always, the rxtx contributors and users will have the final say if it's good or bad though. -- Trent Jarvi tjarvi at qbang.org From gadelavega at yahoo.com.ar Thu Mar 9 17:30:27 2006 From: gadelavega at yahoo.com.ar (Gonzalo A. de la Vega) Date: Thu, 09 Mar 2006 21:30:27 -0300 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: <4410C8A3.1060502@yahoo.com.ar> Well... congratulations!!! Working at Mathworks AND with RxTx is great! I guess we may see your name in some Matlab module (that Mathworks right?) I say is good. Trent Jarvi escribi?: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 and > fixing bugs found in part. To avoid confusion, I will only post to > the list from a Mathworks email address while speaking from this > position as another happy contributor and user. At all other times, > I'll be speaking for myself as usual. The fixes will continue to go > into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus more > on things I enjoy including rxtx. I expect this will be a great thing > for the ongoing LGPL rxtx project too. As always, the rxtx > contributors and users will have the final say if it's good or bad > though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From j.a.horsmeier at wanadoo.nl Thu Mar 9 15:01:44 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Thu, 9 Mar 2006 23:01:44 +0100 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: Message-ID: Trent Jarvi wrote: > I have accepted a position at Mathworks as an Instrument Control Engineer. Congratulations with your new job. Enjoy it. kind regards, Jos From dmarkman at mac.com Thu Mar 9 18:44:58 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Thu, 9 Mar 2006 20:44:58 -0500 Subject: [Rxtx] I'm Joining Mathworks! In-Reply-To: References: Message-ID: welcome to the Mathworks (I'm there too) On Mar 9, 2006, at 3:02 PM, Trent Jarvi wrote: > > The following will not change anything with regards to the rxtx > project. As the maintainer of the project I want to disclose that > working with rxtx is now a part of a position I have accepted. > > I have accepted a position at Mathworks as an Instrument Control > Engineer. This position will involve working with current rxtx 2.1 > and fixing bugs found in part. To avoid confusion, I will only > post to the list from a Mathworks email address while speaking from > this position as another happy contributor and user. At all other > times, I'll be speaking for myself as usual. The fixes will > continue to go into rxtx 2.0 when this becomes possible once more. > > This will be an exciting change for me. I will be able to focus > more on things I enjoy including rxtx. I expect this will be a > great thing for the ongoing LGPL rxtx project too. As always, the > rxtx contributors and users will have the final say if it's good or > bad though. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From chinkaiw at hotmail.com Fri Mar 10 00:16:34 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 07:16:34 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Hi, My machine CPU is intel xscale ixp-422 and the OS is monta vista embedded linux 2.4.18. and JVM is CDC1.0.1 . And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so I can run it without exception. But I have a problem. I can't find the port what I want!!! I tried to list all the port as below. Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 /dev/ttyS0 /dev/ttyS1 It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 How should I do? From tjarvi at qbang.org Fri Mar 10 00:26:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 00:26:17 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Hi, > My machine CPU is intel xscale ixp-422 > and the OS is monta vista embedded linux 2.4.18. > and JVM is CDC1.0.1 . > And I use rxtx2.1.7 and armv5b-softfloat-linux-gnu/librxtxSerial.so > > I can run it without exception. But I have a problem. > I can't find the port what I want!!! > I tried to list all the port as below. > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > /dev/ttyS0 > /dev/ttyS1 > > It only list ttyS0 and ttyS1, but I want to use ttyM0~ttyM7 > How should I do? > Hi Wang I'm glad to see it will work. Did you obtain the binaries from the ToyBox? ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ You can see the INSTALL document that comes with source to see how to override the ports enumerated using properties files [1], create symbolic links to ttyS02-9 or modify RXTXCommDriver and add ttyM to the ports enumerated. You can recreate the Jar file on any system and copy it to your ARM system or just put the new RXTXCommDriver.class in the jar file if you modify RXTXCommDriver.java. It should work with any of the above methods. [1] See "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL -- Trent Jarvi From chinkaiw at hotmail.com Fri Mar 10 01:10:49 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 10 Mar 2006 08:10:49 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: Thanks a lot. I use the command: cvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 myapp It can list ports what I want. Now I 'll test the main I/O function for my device. And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ and I tried several version about arm or xscale but they will throw an exception : java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so ps: Also thanks for your patience of my poor English. From rajesh.invincible at gmail.com Fri Mar 10 05:17:28 2006 From: rajesh.invincible at gmail.com (Rajesh N) Date: Fri, 10 Mar 2006 17:47:28 +0530 Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Excuse me sir i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. what is this M0/M1 etc? PLEASER CLARIFY Thanking you yours sincerely Rajesh On 3/10/06, Wang Chinkai wrote: > > Thanks a lot. > I use the command: > cvm > - > Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > > ps: Also thanks for your patience of my poor English. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060310/73a416e8/attachment-0011.html From tjarvi at qbang.org Fri Mar 10 05:31:14 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:31:14 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> References: <6b2c65f0603100417h2a17b28an702803006274d887@mail.gmail.com> Message-ID: On Fri, 10 Mar 2006, Rajesh N wrote: > Excuse me sir > i thought that the serial ports on linux are /dev/ttyS0 or /dev/tty/S1 etc. > what is this M0/M1 etc? > PLEASER CLARIFY The default serial ports on a motherboard are /dev/ttyS0 and /dev/ttyS1 (COM1 and COM2). If you have other serial ports then you have other kernel drivers. These kernel drivers use different devie files. Linux has fairly complete support for different devices. They could be multiport serial cards or drivers that make USB/IRDA ports look like serial ports. The list of devices is so long it takes noticable time to enumerate all the possibities on Linux so we just do the basics by default: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB" // for USB frobs }; CandidatePortPrefixes=Temp; } We used to try to do all ports. You can still put them back in RXTXCommDriver in the above code. There are probably more devices today. else if(osName.equals("Linux-all-ports")) { /* if you want to enumerate all ports ~5000 possible, then replace the above with this */ String[] Temp = { "comx", // linux COMMX synchronous serial card "holter", // custom card for heart monitoring "modem", // linux symbolic link to modem. "rfcomm", // bluetooth serial device "ttyircomm", // linux IrCommdevices (IrDA serial emu) "ttycosa0c", // linux COSA/SRP synchronous serial card "ttycosa1c", // linux COSA/SRP synchronous serial card "ttyC", // linux cyclades cards "ttyCH",// linux Chase Research AT/PCI-Fast serial card "ttyD", // linux Digiboard serial card "ttyE", // linux Stallion serial card "ttyF", // linux Computone IntelliPort serial card "ttyH", // linux Chase serial card "ttyI", // linux virtual modems "ttyL", // linux SDL RISCom serial card "ttyM", // linux PAM Software's multimodem boards // linux ISI serial card "ttyMX",// linux Moxa Smart IO cards "ttyP", // linux Hayes ESP serial card "ttyR", // linux comtrol cards // linux Specialix RIO serial card "ttyS", // linux Serial Ports "ttySI",// linux SmartIO serial card "ttySR",// linux Specialix RIO serial card 257+ "ttyT", // linux Technology Concepts serial card "ttyUSB",//linux USB serial converters "ttyV", // linux Comtrol VS-1000 serial controller "ttyW", // linux specialix cards "ttyX" // linux SpecialX serial card }; CandidatePortPrefixes=Temp; } Or you can use the properties as described earlier to add individual ports without enumerating everything or changing the code. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Fri Mar 10 05:47:26 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 10 Mar 2006 05:47:26 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: On Fri, 10 Mar 2006, Wang Chinkai wrote: > Thanks a lot. I use the command: > cvm > -Dgnu.io.rxtx.SerialPorts=/dev/ttyM0:/dev/ttyM1:/dev/ttyM2:/dev/ttyM3:/dev/ttyM4:/dev/ttyM5:/dev/ttyM6:/dev/ttyM7 > myapp > > It can list ports what I want. > Now I 'll test the main I/O function for my device. > > And, yes , I obtained the armv5b-softfloat-linux-gnu/librxtxSerial.so from > ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/ > > and I tried several version about arm or xscale but they > will throw an exception : > java.lang.UnsatisfiedLinkError: /root/cvm_rmi/lib/librxtxSerial.so > > Hi Wang, So you just had to find the correct binary for your xscale arm to solve the Link Error? I'd be interested in knowing how things are going. I see we have had 2214 downloads from the ToyBox but we have not had much feedback. I'm not able to test these binaries. I just thought people may find them useful so made a bunch of cross compilers and created the libraries. -- Trent Jarvi tjarvi at qbang.org From richardw at geoquip-rnd.demon.co.uk Sat Mar 11 03:01:32 2006 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Sat, 11 Mar 2006 10:01:32 +0000 Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> Message-ID: <17426.40956.156287.457043@titanic.geolog> Dr. Douglas Lyon writes: > The assumption that the /var/lock folder is in place > is based on the assumption that the user remembered to > run the installer. > My guess is that users will either not read the readme or > forget that an installer needs to be run. > If we really want to make sure that the installer was run, perhaps > we should check. On a mac, typically, /var/lock is not present. > So, we could do a: > File f = new File("/var/lock"); > if (!f.exists()) initLockError(); Not only does the /var/lock directory need to exist, but it also needs to be writable by the current process. If it can't create the lock file for any reason the rxtx error message is rather obscure - i.e. nothing to do with lock files, Richard From lyon at docjava.com Sat Mar 11 07:05:03 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 11 Mar 2006 09:05:03 -0500 Subject: [Rxtx] error checking In-Reply-To: <17426.40956.156287.457043@titanic.geolog> References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: Hi All, Richard makes a good point. In order to make the running of the rxtx lib more user friendly we could take one of two approaches: 1. (The Easy Way):Check the conditions needed to run the program and emit a meaningful error message: "run xyz script as root" or 2. (The Hard Way):Check the conditions needed to run the program and try to fix them, as needed. So: >File f = new File("/var/lock"); > > if (!f.exists()) initLockError(); if (!f.canWrite()) initLockError(); Might be better. The question of how to fix this problem, inside of Java, remains open. We could just punt and print out a nice error message (the easy way). Or we could take The Hard Way; If we prompt the user for the root password, we could do a series of sudo commands, using the runtime exec. But that is hacky and inelegant. My preference would be to do it all from Java. But, how can you create "/var/lock" from Java w/o an invocation to sudo mkdir /var/lock ? Thanks! - D >Dr. Douglas Lyon writes: > > The assumption that the /var/lock folder is in place > > is based on the assumption that the user remembered to > > run the installer. > > My guess is that users will either not read the readme or > > forget that an installer needs to be run. > > > If we really want to make sure that the installer was run, perhaps > > we should check. On a mac, typically, /var/lock is not present. > > So, we could do a: > > >Not only does the /var/lock directory need to exist, but it also needs >to be writable by the current process. If it can't create the lock file >for any reason the rxtx error message is rather obscure - i.e. nothing >to do with lock files, > >Richard > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx From tjarvi at qbang.org Sat Mar 11 11:45:40 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 11:45:40 -0700 (MST) Subject: [Rxtx] error checking In-Reply-To: References: <97B9BF5A-E753-40B1-B1E1-F280D761EB7E@knology.net> <6C4386E4-9EA2-4842-8950-18A0698D25C5@mac.com> <17426.40956.156287.457043@titanic.geolog> Message-ID: On Sat, 11 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Richard makes a good point. > In order to make the running of the rxtx lib more > user friendly we could take one of two approaches: > 1. (The Easy Way):Check the conditions needed to run the program and > emit a meaningful error message: > "run xyz script as root" > or > 2. (The Hard Way):Check the conditions needed to run the program and > try to fix them, as needed. > > So: >> File f = new File("/var/lock"); >> > if (!f.exists()) initLockError(); > if (!f.canWrite()) initLockError(); > > Might be better. The question of how to fix this problem, > inside of Java, remains open. We could just punt and print > out a nice error message (the easy way). > Or we could take The Hard Way; > If we prompt the user for the root > password, we could do a series of sudo commands, using the runtime > exec. But that is hacky and inelegant. > My preference would be to do it all from Java. But, how > can you create "/var/lock" from Java w/o an invocation to > sudo mkdir /var/lock ? Just some thoughts. This isn't a new question obviously. Another related question is how do you use raw sockets in Java. They require root privs too. Raw sockets are probably more in demand though. So one might look at how people have come along with raw sockets. From what I can tell it isn't promising. You may ask some people that have been looking at this for a long time. I see Daniel Savarese started an open source project around the same time as rxtx did doing raw sockets. http://www.savarese.org/software/rocksaw/ If there is a solution for raw sockets, there is a solution for your problem. -- Trent Jarvi tjarvi at qbang.org From g.antini at gmail.com Sat Mar 11 17:15:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 01:15:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <440C6C24.80609@ngi.it> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: Nothing to do. I had clean JRE/JDK from Sun comm api. I'm using version 2.1.7r2, but I have: Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) It is possible that the serial port installed by bluetooth dongle (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may cause problems? Thanks, Gianni Antini On 3/6/06, Fabio Frumento wrote: > Hi Gianni, > > did you clean the JRE/JDK installation files before installing the Rxtx > libraries instead of the sun ones ? > > i fear you could have some problem with your application loading the sun > jar and the Rxtx libs... > > you should work with 2.1.7r2 it is the most recent and supported version > of Rxtx > > let me know. > > Bye! > > Fabio > > > > Gianni Antini ha scritto: > > > Yes of course. I changed the import line ONLY using rxtx-2-1-7. > > Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > > that is not necessary. Right? > > > > Gianni > > > > PS > > Viva l'italia!!! ;-) > > > > On 3/6/06, *Salvo Tomaselli* > > wrote: > > > > Did you change the import line in your .java file? > > > > PS > > Nice to see another Italian here :-D > > > > Gianni Antini ha scritto: > > > I would use RXTX as open alternative of Sun Java Comm API > > implemantation > > > in Windows XP enviroment. > > > Unfortunately I have some problem when use either > > rxtx-2.1-7-bins-r2 or > > > rxtx-2.0-7pre1. > > > > > > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > > > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > > directory > > > and *.dll in bin directory. > > > I also changed javax.comm.properties file with: > > > > > > Driver=gnu.io.RXTXCommDriver > > > > > > My working program (perfectly working with Sun implementation) > > say me: > > > > > > Java lib Version = RXTX-2.0-7pre1 > > > java.io.IOException: Serial port "COM14" does not exist (available > > > serial ports are: ) > > > at cz.darmovzalt.comm.SerialConnection.( > > SerialConnection.java:54) > > > > > > and this code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > don't produce any output. > > > > > > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > > > > > namespace). With this version the above code: > > > > > > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > > > while ( enum.hasMoreElements() ) { > > > CommPortIdentifier cpi = (CommPortIdentifier) > > > enum.nextElement(); > > > System.out.println( cpi.getName() ); > > > } > > > > > > write this: > > > > > > Stable Library > > > ========================================= > > > Native lib Version = RXTX-2.1-7 > > > Java lib Version = RXTX-2.1-7 > > > > > > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > > ports!!!!! > > > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > > > minutes of waiting time I have: > > > > > > java.io.IOException: Underlying input stream returned zero bytes > > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > > (StreamDecoder.java:415) > > > at > > sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > > at java.io.InputStreamReader.read (InputStreamReader.java:167) > > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > > > > > I remark. My program (a GPS program) works well with SUN Api. > > > I must lose every hope and continue to use SUN Implementation? > > > > > > Thank, > > > Gianni Antini > > > Firenze - ITALY > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > >------------------------------------------------------------------------ > > > >_______________________________________________ > >Rxtx mailing list > >Rxtx at qbang.org > >http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 11 22:42:50 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 11 Mar 2006 22:42:50 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: I'm just not sure about this. Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not cause issues. Bluetooth is wireless. It may handle things like timeouts diffently to handle everyday problems. read can return 0. It depends upon the timeout and threshold. RXTX was not giving an exception, it was returning 0 (and maybe for good reason). This may be just a difference in default settings between Sun's CommAPI and rxtx. It is really hard to tell from here. On Sun, 12 Mar 2006, Gianni Antini wrote: > Nothing to do. I had clean JRE/JDK from Sun comm api. > I'm using version 2.1.7r2, but I have: > > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > It is possible that the serial port installed by bluetooth dongle > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > cause problems? > > Thanks, > Gianni Antini > > On 3/6/06, Fabio Frumento wrote: >> Hi Gianni, >> >> did you clean the JRE/JDK installation files before installing the Rxtx >> libraries instead of the sun ones ? >> >> i fear you could have some problem with your application loading the sun >> jar and the Rxtx libs... >> >> you should work with 2.1.7r2 it is the most recent and supported version >> of Rxtx >> >> let me know. >> >> Bye! >> >> Fabio >> >> >> >> Gianni Antini ha scritto: >> >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think >>> that is not necessary. Right? >>> >>> Gianni >>> >>> PS >>> Viva l'italia!!! ;-) >>> >>> On 3/6/06, *Salvo Tomaselli* >> > wrote: >>> >>> Did you change the import line in your .java file? >>> >>> PS >>> Nice to see another Italian here :-D >>> >>> Gianni Antini ha scritto: >>> > I would use RXTX as open alternative of Sun Java Comm API >>> implemantation >>> > in Windows XP enviroment. >>> > Unfortunately I have some problem when use either >>> rxtx-2.1-7-bins-r2 or >>> > rxtx-2.0-7pre1. >>> > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) >>> directory >>> > and *.dll in bin directory. >>> > I also changed javax.comm.properties file with: >>> > >>> > Driver=gnu.io.RXTXCommDriver >>> > >>> > My working program (perfectly working with Sun implementation) >>> say me: >>> > >>> > Java lib Version = RXTX-2.0-7pre1 >>> > java.io.IOException: Serial port "COM14" does not exist (available >>> > serial ports are: ) >>> > at cz.darmovzalt.comm.SerialConnection.( >>> SerialConnection.java:54) >>> > >>> > and this code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > don't produce any output. >>> > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io >>> >>> > namespace). With this version the above code: >>> > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); >>> > while ( enum.hasMoreElements() ) { >>> > CommPortIdentifier cpi = (CommPortIdentifier) >>> > enum.nextElement(); >>> > System.out.println( cpi.getName() ); >>> > } >>> > >>> > write this: >>> > >>> > Stable Library >>> > ========================================= >>> > Native lib Version = RXTX-2.1-7 >>> > Java lib Version = RXTX-2.1-7 >>> > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available >>> ports!!!!! >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 >>> > minutes of waiting time I have: >>> > >>> > java.io.IOException: Underlying input stream returned zero bytes >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes >>> (StreamDecoder.java:415) >>> > at >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) >>> > >>> > I remark. My program (a GPS program) works well with SUN Api. >>> > I must lose every hope and continue to use SUN Implementation? >>> > >>> > Thank, >>> > Gianni Antini >>> > Firenze - ITALY >>> > >>> > >>> > >>> ------------------------------------------------------------------------ >>> > >>> > _______________________________________________ >>> > Rxtx mailing list >>> > Rxtx at qbang.org >>> > http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From g.antini at gmail.com Sun Mar 12 04:51:55 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 12:51:55 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: If I run my program step by step using debugger, the instruction that cause the stall is: Enumeration pidenum = CommPortIdentifier.getPortIdentifiers(); after 3-4 minutes (!!!), I give the list of all my serial port, minus, for strange mysterious reason, port 11 and 12. If I use: CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier( "COM15" ); the 3-4 minutes of waiting time remain. In both cases, I obtain an InputStream from SerialConnection. When I read NMEA sentence from that InputStream, after 50 sentence i get: : : $GPGSV,3,2,09,14,36,105,00,01,20,148,00,28,11,322,00,20,09,223,00*7A $GPGSV,3,3,09,15,07,083,00*48 $GPRMC,114809.839,V,4345.5791,N,01112.2675,E,,,120306,,*1C $GPGGA,114810.838,,*1E java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) at it.gps.Prova.(Prova.java:24) at it.gps.Prova.main(Prova.java:48) Any idea? Gianni Antini P.S. I'm using Matlab everyday at my university for my research activity. Good luck, Trent!!! On 3/12/06, Trent Jarvi wrote: > > I'm just not sure about this. > > Your rxtx-2.1-7 is installed fine. Moving the port from 3-13 should not > cause issues. > > Bluetooth is wireless. It may handle things like timeouts diffently to > handle everyday problems. > > read can return 0. It depends upon the timeout and threshold. RXTX was > not giving an exception, it was returning 0 (and maybe for good reason). > > This may be just a difference in default settings between Sun's CommAPI > and rxtx. It is really hard to tell from here. > > On Sun, 12 Mar 2006, Gianni Antini wrote: > > > Nothing to do. I had clean JRE/JDK from Sun comm api. > > I'm using version 2.1.7r2, but I have: > > > > Stable Library > > ========================================= > > Native lib Version = RXTX-2.1-7 > > Java lib Version = RXTX-2.1-7 > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > It is possible that the serial port installed by bluetooth dongle > > (from "Bluetooth Serial Port 3" to "Bluetooth Serial Port 13", may > > cause problems? > > > > Thanks, > > Gianni Antini > > > > On 3/6/06, Fabio Frumento wrote: > >> Hi Gianni, > >> > >> did you clean the JRE/JDK installation files before installing the Rxtx > >> libraries instead of the sun ones ? > >> > >> i fear you could have some problem with your application loading the sun > >> jar and the Rxtx libs... > >> > >> you should work with 2.1.7r2 it is the most recent and supported version > >> of Rxtx > >> > >> let me know. > >> > >> Bye! > >> > >> Fabio > >> > >> > >> > >> Gianni Antini ha scritto: > >> > >>> Yes of course. I changed the import line ONLY using rxtx-2-1-7. > >>> Since the rxtx-2.0-7pre1 version is a SUN API implementation I think > >>> that is not necessary. Right? > >>> > >>> Gianni > >>> > >>> PS > >>> Viva l'italia!!! ;-) > >>> > >>> On 3/6/06, *Salvo Tomaselli* >>> > wrote: > >>> > >>> Did you change the import line in your .java file? > >>> > >>> PS > >>> Nice to see another Italian here :-D > >>> > >>> Gianni Antini ha scritto: > >>> > I would use RXTX as open alternative of Sun Java Comm API > >>> implemantation > >>> > in Windows XP enviroment. > >>> > Unfortunately I have some problem when use either > >>> rxtx-2.1-7-bins-r2 or > >>> > rxtx-2.0-7pre1. > >>> > > >>> > In the case of rxtx-2.0-7pre1 (With Sun's CommApi) I have put > >>> > RXTXcomm.jar in lib AND/OR ext (Which it is that right one?) > >>> directory > >>> > and *.dll in bin directory. > >>> > I also changed javax.comm.properties file with: > >>> > > >>> > Driver=gnu.io.RXTXCommDriver > >>> > > >>> > My working program (perfectly working with Sun implementation) > >>> say me: > >>> > > >>> > Java lib Version = RXTX-2.0-7pre1 > >>> > java.io.IOException: Serial port "COM14" does not exist (available > >>> > serial ports are: ) > >>> > at cz.darmovzalt.comm.SerialConnection.( > >>> SerialConnection.java:54) > >>> > > >>> > and this code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers(); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > don't produce any output. > >>> > > >>> > I have tried also version rxtx-2.1-7-bins-r2 ( gnu.io > >>> > >>> > namespace). With this version the above code: > >>> > > >>> > Enumeration enum = CommPortIdentifier.getPortIdentifiers (); > >>> > while ( enum.hasMoreElements() ) { > >>> > CommPortIdentifier cpi = (CommPortIdentifier) > >>> > enum.nextElement(); > >>> > System.out.println( cpi.getName() ); > >>> > } > >>> > > >>> > write this: > >>> > > >>> > Stable Library > >>> > ========================================= > >>> > Native lib Version = RXTX-2.1-7 > >>> > Java lib Version = RXTX-2.1-7 > >>> > > >>> > and AFTER 2 o 3 minutes (!!!!!) I obtain the list of available > >>> ports!!!!! > >>> > If I try to use uno of this port (COM14 USB-to-serial port), after 3 > >>> > minutes of waiting time I have: > >>> > > >>> > java.io.IOException: Underlying input stream returned zero bytes > >>> > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes > >>> (StreamDecoder.java:415) > >>> > at > >>> sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java :453) > >>> > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > >>> > at java.io.InputStreamReader.read (InputStreamReader.java:167) > >>> > at java.io.BufferedReader.fill(BufferedReader.java:136) > >>> > > >>> > I remark. My program (a GPS program) works well with SUN Api. > >>> > I must lose every hope and continue to use SUN Implementation? > >>> > > >>> > Thank, > >>> > Gianni Antini > >>> > Firenze - ITALY > >>> > > >>> > > >>> > > >>> ------------------------------------------------------------------------ > >>> > > >>> > _______________________________________________ > >>> > Rxtx mailing list > >>> > Rxtx at qbang.org > >>> > http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> _______________________________________________ > >>> Rxtx mailing list > >>> Rxtx at qbang.org > >>> http://mailman.qbang.org/mailman/listinfo/rxtx > >>> > >>> > >> > >> _______________________________________________ > >> Rxtx mailing list > >> Rxtx at qbang.org > >> http://mailman.qbang.org/mailman/listinfo/rxtx > >> > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From szabo.roland at mithrandir.hu Sun Mar 12 06:02:48 2006 From: szabo.roland at mithrandir.hu (=?ISO-8859-1?Q?Szab=F3_Roland?=) Date: Sun, 12 Mar 2006 14:02:48 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> Message-ID: <44141BF8.904@mithrandir.hu> Hi, Which charset does your InputStreamReader use? If I were you, I'd try reading from the input stream directly first, just to see what you really get, and to make sure that the data can be converted into a character stream. This could be done by a simple while loop, and printing out how many bytes (not chars) you get, or the bytes themselves. This would give us a hint about poosible courses of action I guess. Roland Gianni Antini wrote: > java.io.IOException: Underlying input stream returned zero bytes > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > at java.io.InputStreamReader.read(InputStreamReader.java:167) > at java.io.BufferedReader.fill(BufferedReader.java:136) > at java.io.BufferedReader.readLine(BufferedReader.java:299) > at java.io.BufferedReader.readLine(BufferedReader.java:362) > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > at it.gps.Prova.(Prova.java:24) > at it.gps.Prova.main(Prova.java:48) > > Any idea? > From g.antini at gmail.com Sun Mar 12 07:11:19 2006 From: g.antini at gmail.com (Gianni Antini) Date: Sun, 12 Mar 2006 15:11:19 +0100 Subject: [Rxtx] RXTX on Windows. In-Reply-To: <44141BF8.904@mithrandir.hu> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: I'm using: BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); The device were I read is a GPS receiver, so they return ASCII char. Using SUN JavaComm all is perferctly working. Reading directly from input stream, I don't obtain more IOException. Reading goes!!! However I don't understand why I must wait for 4 minute before obtain a SerialConnection. This is unacceptable, I can't replace JavaComm with RXTX with this limitation. Gianni Antini On 3/12/06, Szab? Roland wrote: > Hi, > > Which charset does your InputStreamReader use? > > If I were you, I'd try reading from the input stream directly first, > just to see what you really get, and to make sure that the data can be > converted into a character stream. This could be done by a simple while > loop, and printing out how many bytes (not chars) you get, or the bytes > themselves. > > This would give us a hint about poosible courses of action I guess. > > Roland > > > Gianni Antini wrote: > > java.io.IOException: Underlying input stream returned zero bytes > > at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) > > at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) > > at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) > > at java.io.InputStreamReader.read(InputStreamReader.java:167) > > at java.io.BufferedReader.fill(BufferedReader.java:136) > > at java.io.BufferedReader.readLine(BufferedReader.java:299) > > at java.io.BufferedReader.readLine(BufferedReader.java:362) > > at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) > > at it.gps.Prova.(Prova.java:24) > > at it.gps.Prova.main(Prova.java:48) > > > > Any idea? > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sun Mar 12 13:29:38 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 13:29:38 -0700 (MST) Subject: [Rxtx] RXTX on Windows. In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: The enumeration is probably taking time because rxtx determines a port is valid by opening it and doing a timed out read. It then checks the errors and decides if the port is there or not. Perhaps just opening the port would be enough. How bluetooth will behave when we try this is not known. I'd imagine its trying to make sure it isnt just a wireless issue on the timed out read. I don't think what Sun is doing is documented. I would not doubt it is different. You can specify the port if you like as described in INSTALL with the source. This should bypass the long enumeration. "Q. How does rxtx detect ports? Can I override it?" ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7/INSTALL On Sun, 12 Mar 2006, Gianni Antini wrote: > I'm using: > > BufferedReader br = new BufferedReader(new InputStreamReader(this.in, "ASCII")); > > The device were I read is a GPS receiver, so they return ASCII char. > Using SUN JavaComm all is perferctly working. > > Reading directly from input stream, I don't obtain more IOException. > Reading goes!!! > However I don't understand why I must wait for 4 minute before obtain > a SerialConnection. This is unacceptable, I can't replace JavaComm > with RXTX with this limitation. > > Gianni Antini > > On 3/12/06, Szab? Roland wrote: >> Hi, >> >> Which charset does your InputStreamReader use? >> >> If I were you, I'd try reading from the input stream directly first, >> just to see what you really get, and to make sure that the data can be >> converted into a character stream. This could be done by a simple while >> loop, and printing out how many bytes (not chars) you get, or the bytes >> themselves. >> >> This would give us a hint about poosible courses of action I guess. >> >> Roland >> >> >> Gianni Antini wrote: >>> java.io.IOException: Underlying input stream returned zero bytes >>> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415) >>> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453) >>> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183) >>> at java.io.InputStreamReader.read(InputStreamReader.java:167) >>> at java.io.BufferedReader.fill(BufferedReader.java:136) >>> at java.io.BufferedReader.readLine(BufferedReader.java:299) >>> at java.io.BufferedReader.readLine(BufferedReader.java:362) >>> at cz.darmovzalt.gps.Nmea.process(Nmea.java:89) >>> at it.gps.Prova.(Prova.java:24) >>> at it.gps.Prova.main(Prova.java:48) >>> >>> Any idea? >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From lyon at docjava.com Sun Mar 12 16:41:15 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sun, 12 Mar 2006 18:41:15 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? Message-ID: Hi All, Typically, if you want to chmod on a file, from within Java, you use: public static void chmod(File file, String mode) throws IOException { Runtime.getRuntime().exec (new String[] {"chmod", mode, file.getAbsolutePath()}); } However, some operations require that this be done as root. For example: sudo usermod -G uucp,lock lyon Would add me to the UUCP and LOCK groups. Typically, sudo prompts for a password. How would you modify the below to reflect the root password and enable invocation? public static void chgrp(String uid, String rootPw) throws IOException { Runtime.getRuntime().exec (new String[] {"sudo usermod -G uucp,lock ", uid}); } Thanks! - Doug From tjarvi at qbang.org Sun Mar 12 18:56:24 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 18:56:24 -0700 (MST) Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: On Sun, 12 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > Hi Doug Its not like I'm not thinking. :) If anyone can make it work it is Dr Doug Lyon. My gut feeling is this is the wrong direction. Native applications can instantiate java. Native applications can do what you want. Java does not own the scope beyond its domain. Even if it tries. If you find a way, its a security issue. Not because you help.. because I [1] could think of an abuse in 5 min. [1] lets not go into taj's previous youth - I'm 43 now and looking at houses. [1.1] It was fun... -- Trent Jarvi tarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 21:21:24 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 04:21:24 +0000 Subject: [Rxtx] problem about xscale-linux Message-ID: My machine is MOXA which has 8 serial port look like rj45 port. I must use a connector to transfer serial to rj45. >Hi Wang, >So you just had to find the correct binary for your xscale >arm to solve >the Link Error? I'd be interested in knowing how things >are going. I see >we have had 2214 downloads from the ToyBox but we have not >had much >feedback. I'm not able to test these binaries. I just >thought people may >find them useful so made a bunch of cross compilers and >created the >libraries. Yes , I don't compile again. I just download the RXTXcomm.jar and librxtxSerial.so , and put them in my jdk lib , it works. But , I want to know , is the version stable? Now,I can write and receive through rs232 port without any exception . But I don't know what will happen in the future. From tjarvi at qbang.org Sun Mar 12 22:21:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 12 Mar 2006 22:21:06 -0700 (MST) Subject: [Rxtx] problem about xscale-linux In-Reply-To: References: Message-ID: > But , I want to know , is the version stable? Now,I can write and receive > through rs232 port without any exception . But I don't know what will happen > in the future. A fair question. The bottom line is I want to work with Sun to help make your dicision easier. This is just an API that can help us all. Even in my new position. The source? yes. Thats 9 years of community effort. Its solid source but not Sun stuff. Things break because we don't know. But it is used in major products you would recognize. Your car is probaly made with rxtx. your road signs probably use rxtx. There needs to be some standardization there. But right now? use rxtx. Dont do worse. The binaries? No.. If you want stable you should do it yourself. That was proof of concept. -- Trent Jarvi tjarvi at qbang.org From chinkaiw at hotmail.com Sun Mar 12 23:42:22 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Mon, 13 Mar 2006 06:42:22 +0000 Subject: [Rxtx] How to detect device is connected or disconnected Message-ID: Hi, Because I will remote control the machine which connect the rs232 device . So , I have a problem , I don't know that is the rs232 device connect to the machine. Maybe the device is turn off , or someone pull out the line. I should know the device connection status. How should I do? thanks. From daniel.blackburn at ntlworld.com Mon Mar 13 03:19:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Mon, 13 Mar 2006 10:19:38 +0000 Subject: [Rxtx] Newbie questions In-Reply-To: References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> Message-ID: <4415473A.4000407@ntlworld.com> Hello, I did some serial development about 6 months ago using javax.comm and sun comm api. It was a very simple program developed using JDK 1.4 under windows and simply communicated to a wireless serial dongle via a serial port. I now need to update this program and to my horror Sun seemed to have dropped support for windows with their latest serial port api : / So it looks like I need to switch to RXTX, which actually looks like a better solution as it looks to be more cross platform solution than Suns amazingly. Thats the background, now on to my newbie questions : - Is there a 'best' version of RXTX to use which should be more compatible with Java code created to work with the old serial API from sun? - Do you have to compile RXTX for windows or are there compiled JARs available. I downloaded the latest release and couldn't see a windows version? - Am I right to switch to RXTX or should I be looking at using something else? I want to try and stick with Java if possible as ideally the end code needs be as portable between platforms as possible. Thanks in advance for any help. Sorry if any of the above is covered in the wiki but that seems to be down at the moment. Cheers, Dan From sean_montgomery at baseview.com Mon Mar 13 06:43:04 2006 From: sean_montgomery at baseview.com (Sean Montgomery) Date: Mon, 13 Mar 2006 08:43:04 -0500 Subject: [Rxtx] fixing rxtx configurations...you need to be root for this, right? In-Reply-To: References: Message-ID: <6E97942B-3D98-416A-9631-425395B26CED@baseview.com> On Mar 12, 2006, at 6:41 PM, Dr. Douglas Lyon wrote: > Hi All, > Typically, if you want to chmod on a file, from within Java, you use: > > public static void chmod(File file, String mode) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"chmod", mode, file.getAbsolutePath()}); > } > > However, some operations require that this be done as root. For > example: > sudo usermod -G uucp,lock lyon > > Would add me to the UUCP and LOCK groups. Typically, sudo prompts > for a password. How would you modify the below to reflect the root > password > and enable invocation? > public static void chgrp(String uid, String rootPw) throws IOException > { > Runtime.getRuntime().exec > (new String[] > {"sudo usermod -G uucp,lock ", uid}); > } > > Thanks! > - Doug Just a friendly word of warning - it's not well documented by Sun, at least I didn't ever find it - but if you make a Runtime.getRuntime.exec call, you should always get the Process object returned by the exec() call and either: 1) explicitly get and close the input, output and error streams for the Process, whether you used them or not, or more simply 2) call Process.destroy. If not you'll leak resources. Not a big deal if you only call exec occasionally, but if you do it a lot you may start getting "IOException: Broken Pipe" errors. Just FYI, HTH :-) From salifouberthe1 at yahoo.fr Mon Mar 13 08:46:05 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Mon, 13 Mar 2006 16:46:05 +0100 Subject: [Rxtx] nativeDrain Message-ID: <441593BD.2060104@yahoo.fr> Hello, I am developpe an application which must read port COM5: on PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not arrive has to call method FLUSH. For example in the following code: public String communique(String envoie){ String poids = null; ..... sPort = (SerialPort) portId.open("UtilisationFlux", 30000); .... sPort.setSerialPortParams( 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ... outStream = sPort.getOutputStream(); System.out.println("7"); bufRead = new BufferedReader( new InputStreamReader(sPort.getInputStream())); ... try { //demande de poids byte[] bits = envoie.getBytes(); for (int i = 0; i < bits.length; i++) { System.out.println("send : "+bits[i]); outStream.write(bits[i]); } System.out.println("send : 13"); outStream.write(13); System.out.println("envoie de : 0"); outStream.write(0); System.out.println("envoie de : OK"); outStream.flush(); if(bufRead.ready()){ System.out.println("ready ready ready"); } poids = bufRead.readLine().trim(); } catch (IOException e) { System.out.println(""+e.getMessage()); } return poids; } I have the following exception as soon as I call outStream.flush(); Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain Help me please. From tjarvi at qbang.org Mon Mar 13 23:47:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 13 Mar 2006 23:47:52 -0700 (MST) Subject: [Rxtx] mail-list bits Message-ID: Many people like to join the rxtx mail list from vanity domains (like qbang.org :) that expire a year later. We have almost 400 people on the mail-list so some normal mail-list issues are starting to show up. These expired domains are creating a problem. I'm moving these folks to /dev/null for email without contacting them. I don't know what else to do. So if you lapse on your vanity domain and don't see rxtx email, you know what happened. The next thing we will see is spam. But I pitty the fool. We are ready. qbang and rxtx dot org are registered for multiple (10 or so) years at a time so dont worry about them :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Mar 14 00:32:25 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 00:32:25 -0700 (MST) Subject: [Rxtx] nativeDrain In-Reply-To: <441593BD.2060104@yahoo.fr> References: <441593BD.2060104@yahoo.fr> Message-ID: On Mon, 13 Mar 2006, Salifou BERTH? wrote: > Hello, I am developpe an application which must read port COM5: on > PocketPC2002. For that I use Rxtx-2.0-1 API but I have a problem. I do not > arrive has to call method FLUSH. For example in the following code: > public String communique(String envoie){ > String poids = null; > ..... > sPort = (SerialPort) portId.open("UtilisationFlux", 30000); > .... > sPort.setSerialPortParams( > 9600, > SerialPort.DATABITS_8, > SerialPort.STOPBITS_1, > SerialPort.PARITY_NONE); > ... > outStream = sPort.getOutputStream(); > System.out.println("7"); > bufRead = > new BufferedReader( > new InputStreamReader(sPort.getInputStream())); > ... > try { > //demande de poids > byte[] bits = envoie.getBytes(); > for (int i = 0; i < bits.length; i++) { > System.out.println("send : "+bits[i]); > outStream.write(bits[i]); > } > System.out.println("send : 13"); > outStream.write(13); > System.out.println("envoie de : 0"); > outStream.write(0); > System.out.println("envoie de : OK"); > outStream.flush(); > if(bufRead.ready()){ > System.out.println("ready ready ready"); > } > poids = bufRead.readLine().trim(); > } catch (IOException e) { > System.out.println(""+e.getMessage()); > } > return poids; > } > > I have the following exception as soon as I call outStream.flush(); > Exception in thread "main", java.lang.UnsatisfiedLinjError: nativeDrain > Hi Salifou rxtx-2.0-1 isn't maintainable. You can obtain the source and do what you like but I would not. That was before substantial w32 fixes. There is a hiccup in the 2.0 release cycle but you should be trying 2.0-7pre1. We can help you from there. -- Trent Jarvi tjarvi at qbang.org From salifouberthe1 at yahoo.fr Tue Mar 14 05:47:14 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Tue, 14 Mar 2006 13:47:14 +0100 Subject: [Rxtx] nativeDrain In-Reply-To: References: <441593BD.2060104@yahoo.fr> Message-ID: <4416BB52.3000901@yahoo.fr> Hi Thank you for your answer, I recovered the source code 2.0-7pre1 but I do not manage to create the DLL for WinCe. Can somebody send that to me? Thank you From s.tomaselli at jdialer.net Tue Mar 14 07:58:14 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 15:58:14 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DA06.8070107@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/3d6a8aaf/s.tomaselli-0011.vcf From s.tomaselli at jdialer.net Tue Mar 14 08:02:29 2006 From: s.tomaselli at jdialer.net (Salvo Tomaselli) Date: Tue, 14 Mar 2006 16:02:29 +0100 Subject: [Rxtx] Newbie questions In-Reply-To: <4415473A.4000407@ntlworld.com> References: <440C1063.5020308@jdialer.net> <440C6C24.80609@ngi.it> <44141BF8.904@mithrandir.hu> <4415473A.4000407@ntlworld.com> Message-ID: <4416DB05.50404@jdialer.net> > Thats the background, now on to my newbie questions : > > - Is there a 'best' version of RXTX to use which should be more > compatible with Java code created to work with the old serial API from sun? the only thing you need to do is to change the import line. > > - Do you have to compile RXTX for windows or are there compiled JARs > available. I downloaded the latest release and couldn't see a windows > version? there is no need to compile. > > - Am I right to switch to RXTX or should I be looking at using something > else? I want to try and stick with Java if possible as ideally the end > code needs be as portable between platforms as possible. rxtx is good for serial ports. > > Thanks in advance for any help. Sorry if any of the above is covered in > the wiki but that seems to be down at the moment. -------------- next part -------------- A non-text attachment was scrubbed... Name: s.tomaselli.vcf Type: text/x-vcard Size: 191 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060314/4d5501c9/s.tomaselli-0011.vcf From tjarvi at qbang.org Tue Mar 14 16:45:00 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 14 Mar 2006 16:45:00 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! Message-ID: I've figured out the virtual domain problem that was causing problems with the wiki. Actually I just started over and it worked this time. There isn't very much material there at this point. If you have a few minutes, please consider contributing something. We can also add answers from the mail-list as they appear. Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and did a quick conversion to the wiki format. There are still multiple minor issues with this page too. http://rxtx.qbang.org/wiki/index.php/Installation The front page of the wiki is at http://rxtx.qbang.org/wiki/ We certainly will need help with the wiki. Any contributions would be greatly appreciated. You do not need to be a programmer to help. In fact it may help to not be a programmer. We can also answer questions here as you run into problems. All content in the wiki is licensed under the GNU Free Documentation License 1.2. http://www.gnu.org/copyleft/fdl.html Thanks, -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Wed Mar 15 00:02:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 00:02:47 -0700 (MST) Subject: [Rxtx] mail-list features. Message-ID: Two minor changes. The first is the mail-list archives are now sorted by week rather than day. I thought that was "update daily" when I selected it. The old links are still there so ChangeLog still points to the correct posts. The second is there is now search capability. I had a battle with mailman templates and lost the first round but you can search the list for now from the rxtx mail-list information page. The search db will be rebuilt once a day. http://mailman.qbang.org/mailman/listinfo/rxtx I hope that helps. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 01:09:25 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 09:09:25 +0100 Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: References: Message-ID: <4417CBB5.9090508@willicon.de> Trent, thanks for Your great tool. I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to RxTx, since Sun did not support Win32. My question: How must I mention RxTx technology in my About dialog, that I did not run in license problems? Is a link enough? The RXTXcomm.jar is bundled in my JAR file. I develop freeware, but not under GNU or something else. I did not spread the code, only classes. Maybe a new license section in the Wiki would be helpfully. Thanks, Hans Trent Jarvi schrieb: > > I've figured out the virtual domain problem that was causing problems > with the wiki. Actually I just started over and it worked this time. > > There isn't very much material there at this point. If you have a few > minutes, please consider contributing something. We can also add > answers from the mail-list as they appear. > > Right now, I just put the RXTX 2.1 INSTALL directions in the wiki and > did a quick conversion to the wiki format. There are still multiple > minor issues with this page too. > > http://rxtx.qbang.org/wiki/index.php/Installation > > The front page of the wiki is at > > http://rxtx.qbang.org/wiki/ > > We certainly will need help with the wiki. Any contributions would be > greatly appreciated. You do not need to be a programmer to help. In > fact it may help to not be a programmer. We can also answer questions > here as you run into problems. > > All content in the wiki is licensed under the GNU Free Documentation > License 1.2. http://www.gnu.org/copyleft/fdl.html > > Thanks, > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/85d371cf/attachment-0011.html From lyon at docjava.com Wed Mar 15 04:55:40 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 06:55:40 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: Hi All, I tried the mac installer (for a good time). Following the directions, I used; sudo mkdir /var/spool/uucp Password: powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp users `whoami` powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp users `whoami` The RXTX 2.1 Installer says: "There were errors installing the software"..."Please try again". So I tried it again, and got the same error. Help I am stuck in a loop. Help, I am stuck in a loop, Help... Thanks! - Doug From lyon at docjava.com Wed Mar 15 05:23:06 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 07:23:06 -0500 Subject: [Rxtx] Can you HTDIG it? In-Reply-To: References: Message-ID: I really dig the HTDig... WAY cool! Thanks Trent! - Doug From tjarvi at qbang.org Wed Mar 15 09:05:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:05:52 -0700 (MST) Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: On Wed, 15 Mar 2006, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / /groups/uucp > users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / /groups/uucp > users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > I think this was my fault several months ago and is probably related to the Solaris problem. I'll ask Dmitry to confirm but I don't think we are using /var/spool/uucp but rather /var/spool/lock. This looks like a sed mistake on my part. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Wed Mar 15 09:05:55 2006 From: mail at willicon.de (WILLICon) Date: Wed, 15 Mar 2006 17:05:55 +0100 Subject: [Rxtx] RXTX problems on Solaris Message-ID: <44183B63.40800@willicon.de> Hi, we try to change our serial communication from sun's api to rxtx to connect bicycle computers. It works on MacOS, Linux, XP but I have problems on Solaris Plattform. I have added my login to group uucp, sys and lock I have permission to write /dev/term/a (It works with sun's commapi) I have the libraries local and added the LD_LIBRARY_PATH. java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) Machine SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 Program call: java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren RxTx-Output: Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 # RxTx Ports avail: false User: > > id -a agu > uid=2064(agu) gid=102(tmns) groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) No ports found. What can I do? What is wrong? Can you help me? Greetings, Hans -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060315/8d025af2/attachment-0011.html From tjarvi at qbang.org Wed Mar 15 09:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 09:27:32 -0700 (MST) Subject: [Rxtx] Re: RxTx don't works on Solaris (fwd) Message-ID: Moving the discussion to the mail-list ---------- Forwarded message ---------- Date: Wed, 15 Mar 2006 08:46:22 -0700 (MST) From: Trent Jarvi Cc: taj at www.linux.org.uk Subject: Re: RxTx don't works on Solaris On Wed, 15 Mar 2006 > Hi, > > we try to change our serial communication from sun's api > to rxtx to connect bicycle computers. > > It works on MacOS, Linux, XP but I have problems on Solaris > Plattform. > > I have added my login to group uucp, sys and lock > I have permission to write /dev/term/a (It works with sun's commapi) > > I have the libraries local and added the LD_LIBRARY_PATH. > > > java version "1.4.2_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) > > Machine > SunOS sun06 5.9 Generic_118558-02 sun4u sparc SUNW,Sun-Blade-2500 > > Program call: > java -Dgnu.io.rxtx.SerialPorts=/dev/term/a:/dev/term/b -cp > "bikeXperience.jar:RXTXcomm.jar" MTBTouren.MTBTouren > > RxTx-Output: > > Experimental: JNI_OnLoad called. > Stable Library > ========================================= > Native lib Version = RXTX-2.1-7 > Java lib Version = RXTX-2.1-7 > # RxTx Ports avail: false > > User: >> id -a agu > uid=2064(agu) gid=102(tmns) > groups=3(sys),5(uucp),7(tty),65535(lock),102(tmns) > > No ports found. What can I do? What is wrong? > Can you help me? > Hmm. I guess thats not expected. I only had a machine to compile on. I could not test it. It should be possible to use dtrace to find out what is failing. Look for opening lockfiles and ports. just following open() read() and write() should show the error. You should not have to override the ports with the properties. Thats taken care of in RXTXCommDriver.java. Solaris has worked. It is very possible there is a regression though. If you are able to compile the jar, there are several debug variables in RXTXCommDriver and RXTXPort.java that can be turned on. The last version of rxtx to do through testing for Solaris was rxtx-2.1-7pre17 but I did not recieve binaries from that effort. You would have to compile it yourself. Another issue is when we did compile that version, we tested with the --disable-lockfiles option at configure time. There could be a problem in the lockfile code for Solaris Perhaps the LOCKDIR is not defined right in SerialImp.h. #if defined(__sun__) /* Solaris */ # define DEVICEDIR "/dev/" # define LOCKDIR "/var/spool/locks" # define LOCKFILEPREFIX "LK." That does look wrong. I bet solaris uses /var/spool/uucp or such. You can use tip or like programs that will create a lockfile and see. If thats the problem, I can recompile the library for you. There will be another round of testing on Solaris but not for several weeks. You may need to find the problem to get a timely answer. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Wed Mar 15 11:09:53 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 15 Mar 2006 13:09:53 -0500 Subject: [Rxtx] mac file error In-Reply-To: <44183B63.40800@willicon.de> References: <44183B63.40800@willicon.de> Message-ID: Hi All, I think this might be the bug in the mac version: more RXTX.pre_install #!/bin/sh sudo mkdir /var/spool/uucp sudo chmod 775 /var/spool/uucp sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep 'login' | sed 's /login.//'` - Doug From tjarvi at qbang.org Wed Mar 15 16:38:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 15 Mar 2006 16:38:28 -0700 (MST) Subject: [Rxtx] The RXTX Wiki is up! In-Reply-To: <4417CBB5.9090508@willicon.de> References: <4417CBB5.9090508@willicon.de> Message-ID: On Wed, 15 Mar 2006, WILLICon wrote: > Trent, > > thanks for Your great tool. > > I just now use RxTx 2.1 for my application. I switched from Sun's CommApi to > RxTx, since Sun did not support Win32. > > My question: How must I mention RxTx technology in my About dialog I can not answer legal questions (thats what licenses and lawyers are for) but I can suggest it would help your users if they knew what version of rxtx they are using, the License and what the homepage of rxtx is for bug reporting or obtaining the source to the rxtx that is used in your product. About Dialogs would be one way. Plain text files would be another way. > I develop freeware, but not under GNU or something else. Thats fine. We don't worry about how you license your original work. We can't restate the license on the wiki. The license is final and should be understood. But if you read the license, I think it will make sense to you. Many companies with legal resources have explained bits of the LGPL in FAQs using their own words. JBoss for instance: http://www.jboss.com/opensource/lgpl/faq especially this section: http://www.jboss.com/opensource/lgpl/faq#bundle You can search for many more on the Internet. These are usually groups with big financial backing like JBoss, OpenOffice, ... that have legal teams to approve the comments. When rxtx is bigger than OpenOffice, we can put our own comments up too :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Wed Mar 15 18:43:25 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:43:25 -0500 Subject: [Rxtx] errors on mac installation In-Reply-To: References: Message-ID: <04FE07F6-3C31-4A78-B2D4-6D5C9DF1B8D0@mac.com> latest 2.1 tarball has installer package did you try it also latest 2.1 uses /var/lock On Mar 15, 2006, at 6:55 AM, Dr. Douglas Lyon wrote: > Hi All, > I tried the mac installer (for a good time). > Following the directions, I used; > sudo mkdir /var/spool/uucp > Password: > powerbook.docjava.com{lyon}21: sudo chmod 775 /var/spool/uucp > powerbook.docjava.com{lyon}22: sudo niutil -destroyval / / > groups/uucp users `whoami` > powerbook.docjava.com{lyon}23: sudo niutil -appendprop / / > groups/uucp users `whoami` > > The RXTX 2.1 Installer says: > "There were errors installing the software"..."Please try again". > > So I tried it again, and got the same error. Help I am > stuck in a loop. Help, I am stuck in a loop, Help... > > Thanks! > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From dmarkman at mac.com Wed Mar 15 18:51:38 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Wed, 15 Mar 2006 20:51:38 -0500 Subject: [Rxtx] mac file error In-Reply-To: References: <44183B63.40800@willicon.de> Message-ID: <23F22722-916B-47E1-8CE2-14FB7FFAFAED@mac.com> where do you see the bug? what kind of error message do you see? latest Apple's packages accepts preinstall scripts with the name preinstall only here is a latest preinstall script #!/bin/sh curruser=`sudo id -p | grep 'login' | sed 's/login.//'` echo $curruser if [ ! -d /var/lock ] then sudo mkdir /var/lock fi sudo chgrp uucp /var/lock sudo chmod 775 /var/lock if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] then sudo niutil -mergeprop / /groups/uucp users $curruser fi exit 0; I highly recommend to use installer from the latest 2.1 tarball RXTX_Tiger.pmproj.sitx.hqx from the folder rxtx-devel/MACOSX_ISE/ForPackageMaker I remind you that latest rxtx implementation is universal binary On Mar 15, 2006, at 1:09 PM, Dr. Douglas Lyon wrote: > Hi All, > I think this might be the bug in the mac version: > more RXTX.pre_install > #!/bin/sh > sudo mkdir /var/spool/uucp > sudo chmod 775 /var/spool/uucp > sudo niutil -destroyval / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > sudo niutil -appendprop / /groups/uucp users `sudo id -p | grep > 'login' | sed 's > /login.//'` > > - Doug > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From salifouberthe1 at yahoo.fr Thu Mar 16 06:48:24 2006 From: salifouberthe1 at yahoo.fr (=?ISO-8859-1?Q?Salifou_BERTH=C9?=) Date: Thu, 16 Mar 2006 14:48:24 +0100 Subject: [Rxtx] bad file descriptor error Message-ID: <44196CA8.2060601@yahoo.fr> Hi all I'm using version rxtx-2.1-7 on pocketPC 2002 and Jeode When I close a serial port with sp.close() (where sp is a SerialPort) sometimes an error occour 1119256168085: RXTXPort:close detected bad file descriptor What can I do? Thanks From tjarvi at qbang.org Thu Mar 16 10:10:17 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 10:10:17 -0700 (MST) Subject: [Rxtx] Re: Help: 14400 - don't work (fwd) Message-ID: On Thu, 16 Mar 2006 > Hi, Tren! > > Glad to write to you again:) > > I' java developer from Cherkasy Urkaine. > I'm working with rxtx serial port driver more 4 years and very happy with it. > Good style, JComm compatibility, Linux support and well documented. > > Before I did use rxtx on redhat 7.2, 7.3, 9 Linuxes, compiled from sources > and downloaded binnay, both. > All ok on Linux. > > But today I have a unresolver problem on Windows XP (SP1) with scales from > S.Petersburg (Russia) named Mera iScales. It has a requirements for comm > protocol: 14400 baundrate, parity: MARK SPACE. > > Parity: MARK SPACE works fine, JComm unsupport them, you are great now:) > > But 14400 - don't work, and port opens with 9600 (I think it's default). Is > it possible to use 14400? > > I did see in SerialImpl.c case on predefined param B14400 > #ifdef B14400 > case B14400: return 14400; > #endif /* B14400 */ > > but in SerialImpl.h it's commnted > /* this is now handled in SerialImp.c > #define B14400 1010001 > .... > > and in win32termios.h commented too > /* glue for unsupported linux speeds see also SerialImp.h */ > /* hosed */ > #define B14400 1010001 > ..... > > I'm not a C/CPP programmer, but see that so many places with one definition > used. > > I did try compile it on my windows with lcc, it's C compliler. And it doesn't > work. Tell UnsatisfiedLinkError on port init. > Experments with mingw and MSVC failed in build time. > It's more easy to compile on linux when you are not C/Cpp developer:) > > Can you help me here, may be can send binnary with 14400 support. This is a known problem in rxtx that will be fixed in the next release. It is not a very simple problem because of the way rxtx works. So right now the only thing we could do is hardcode the default to 14400 for you in a binary. If thats all you would need I could do that this weekend. If you needed to be able to change the port on the fly you will have to wait until rxtx 2.1-8/2.0-8. I didnt see which version of rxtx you are using. > > PS: Also I find that if I use JComm for win32, it's sets a XOn(to 0x11) > XOff(to 0x13) chars when init port inside. This chars direct setting in java > is impossible. And in rxtx both is sets to value 0x00 > Could you explain this again with rxtx version, wether JComm is Sun or not and which OS is 0x00? I'm just a little confused. Do you want to be able to set the chars from java or just have them one way or the other? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 12:25:42 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 18:25:42 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched Message-ID: <4419BBB6.6060103@tiscalinet.be> Hi, I'm using RxTx to communicate with a device which needs to receive an acknowledgement after each frame it sends. Strangely, I frequently notice that the device retries some messages, and I'm suspecting it's because I don't acknowledge the message quickly enough. Hence my question : my code registers an event listener much like in the SimpleRead example - http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm wondering what exactly triggers the DATA_AVAILABLE event dispatching and if there is a way to change it. Indeed, it often happens that the byte buffer I receive already contains 2 frames from the device, like if the event handler was called so late that the device already has retried. Moreover, I'm now using RxTx because of the dropped support by Sun on Windows, but in my first tries with Sun's obsolete version 2, I never had noticed such a behaviour and it could be because this "event dispatching trigger" is implementation-dependant. Any information or comment is welcome. Best regards Vicne. PS : In case anyone is interested, the device in question is a car head unit - http://tlcdcemu.sourceforge.net From tjarvi at qbang.org Thu Mar 16 13:04:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 13:04:30 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419BBB6.6060103@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Hi, > > I'm using RxTx to communicate with a device which needs to receive an > acknowledgement after each frame it sends. > Strangely, I frequently notice that the device retries some messages, and > I'm suspecting it's because I don't acknowledge the message quickly enough. > > Hence my question : my code registers an event listener much like in the > SimpleRead example - > http://java.sun.com/developer/releases/javacomm/SimpleRead.java - and I'm > wondering what exactly triggers the DATA_AVAILABLE event dispatching and if > there is a way to change it. > > Indeed, it often happens that the byte buffer I receive already contains 2 > frames from the device, like if the event handler was called so late that the > device already has retried. > > Moreover, I'm now using RxTx because of the dropped support by Sun on > Windows, but in my first tries with Sun's obsolete version 2, I never had > noticed such a behaviour and it could be because this "event dispatching > trigger" is implementation-dependant. > > Any information or comment is welcome. > > Best regards > > Vicne. > PS : In case anyone is interested, the device in question is a car head unit > - http://tlcdcemu.sourceforge.net > This is a little complicated because we are dealing with different threads (events vs read) but isnt too bad. Could this be because rxtx will not send DATA_AVAILABLE after a read until there is new data available? rx->Frame rx->Frame DATA_AVAILABLE=true read( 1 Frame ); DATA_AVAILABLE=false rx->Frame DATA_AVAILABLE=true We could check if there is still data on the port but don't. Another possibilty is the native code slows down the eventLoop while data is available. select() wont block so it's sleep()ing for what appears to be 20 ms. That could certainly be tuned and could be causing what you see. How much time do you think is between frames? rx->Frame DATA_AVAILABLE=true & sleep 20 ms read(1 Frame) rx->frame 20ms expires DATA_AVAILBLE=true Which looks more plausable from your end? -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 13:47:58 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 19:47:58 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> Message-ID: <4419CEFE.2010303@tiscalinet.be> First let me thank you for your quick reply. > This is a little complicated because we are dealing with different > threads (events vs read) but isnt too bad. > > Could this be because rxtx will not send DATA_AVAILABLE after a read > until there is new data available? > > rx->Frame > rx->Frame > DATA_AVAILABLE=true > read( 1 Frame ); > DATA_AVAILABLE=false > rx->Frame > DATA_AVAILABLE=true Well, not exactly. As the frames are of unknown length, the read in the above example reads all available data : byte [] buff = new byte[256]; int nbByte = inStream.read(buff); So I'm getting 2 frames, not one. > We could check if there is still data on the port but don't. > > Another possibilty is the native code slows down the eventLoop while > data is available. select() wont block so it's sleep()ing for what > appears to be 20 ms. That could certainly be tuned and could be > causing what you see. How much time do you think is between frames? Well, actually, it's not easy to determine precisely, but according to some logs of previous spying of the protocol, the timeout before the device retries is around 20 or 25 ms (with pc clock accuracy), so it could be the cause indeed. > rx->Frame > DATA_AVAILABLE=true & sleep 20 ms > read(1 Frame) > rx->frame > 20ms expires DATA_AVAILBLE=true > > Which looks more plausable from your end? Yes, something like that. Is there a way to decrease this sleep ? Or maybe I should code another way, with a read() that blocks until some data is ready (with a threshold of 1 byte or so). Would it solve the problem ? Any advice is welcome. Kind regards, Vince. From tjarvi at qbang.org Thu Mar 16 15:27:32 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 15:27:32 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419CEFE.2010303@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: >> Another possibilty is the native code slows down the eventLoop while data >> is available. select() wont block so it's sleep()ing for what appears to >> be 20 ms. That could certainly be tuned and could be causing what you see. >> How much time do you think is between frames? > > Well, actually, it's not easy to determine precisely, but according to > some logs of previous spying of the protocol, the timeout before the device > retries is around 20 or 25 ms (with pc clock accuracy), so it could be the > cause indeed. > >> rx->Frame >> DATA_AVAILABLE=true & sleep 20 ms >> read(1 Frame) >> rx->frame >> 20ms expires DATA_AVAILBLE=true >> >> Which looks more plausable from your end? > > Yes, something like that. > Is there a way to decrease this sleep ? > Or maybe I should code another way, with a read() that blocks until some > data is ready (with a threshold of 1 byte or so). Would it solve the problem > ? > Hi Vince This is going to require recompiling rxtx. We don't have anything you can tinker with without recompiling the .dll. I can try that for you tonight. I'll put a binary and patch for testing up tonight but if it isnt exactly what you need, the best I can do is give you access to the 'bob account' where you can login and make your own modified binaries. You can contact me off the list about that if you need it. The patch should give you an idea what to look at. I'll post to the list after I make the binary. I also have to post a hack for 14400 Baud rates so its not a big deal to do them both at once. If you have a good test case and we can put a binary together to see, lets give it a try. You could also poll with reads like you mention by setting the timeout 0 or large and threshold nonzero or even 0. Not an ideal way to do it from a java perspective. -- Trent Jarvi tjarvi at qbang.org From vdeconinck at tiscalinet.be Thu Mar 16 16:04:07 2006 From: vdeconinck at tiscalinet.be (Vince) Date: Thu, 16 Mar 2006 22:04:07 -0100 Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: <4419EEE7.9060602@tiscalinet.be> Trent Jarvi wrote: > This is going to require recompiling rxtx. We don't have anything you > can tinker with without recompiling the .dll. I can try that for you > tonight. Just a note I'm thinking of right now : can you confirm that RxTx follows Sun's default behaviour regarding enableReceiveTimeout(), that is, receive timeout is not enabled by default ? Because the reason could also be that the DATA_AVAILABLE is dispatched quickly enough, but then the inStream.read(buff) blocks for a certain time before returning... I admit I don't explicitely call disableReceiveTimeout()... > I'll put a binary and patch for testing up tonight but if it isnt > exactly what you need, the best I can do is give you access to the > 'bob account' where you can login and make your own modified > binaries. You can contact me off the list about that if you need it. > The patch should give you an idea what to look at. > > I'll post to the list after I make the binary. I also have to post a > hack for 14400 Baud rates so its not a big deal to do them both at once. OK, just to make sure I understand, it's going to be a binary with a shorter timeout, right ? If it requires recompiling on Windows, it shouldn't be a big deal an I guess I could do it with mingw, I guess... (but well, I might be wrong :-)). > You could also poll with reads like you mention by setting the timeout > 0 or large and threshold nonzero or even 0. Not an ideal way to do it > from a java perspective. I didn't mean polling, I meant just issuing a read() with a 1-byte threshold that would block until there is at least one byte available (*) from the UART and let me read the flow byte per byte as it comes, build up the byte array myself etc. (*) But maybe the trigger that would return from the read() is the same as the one that sends the DATA_AVAILABLE... If so, well, of course it wouldn't change anything : the read() would only return after the timeout has passed and I would also have the 2 frames waiting... > If you have a good test case and we can put a binary together to see, > lets give it a try. Well, the test case currently requires the car head unit as it's the "impatient" device :-). But I can try it here quite easily and I should be able to tell quickly whether I still have those retries or not. Anyway, this will be for tomorrow... Thanks very much for your time and insightful answers. Vince. -- ........... Vince ................. mailto:vince at indo-chine.org .... .. Discographie Indochine ....... http://www.indo-chine.org/disco .. From tjarvi at qbang.org Thu Mar 16 16:19:23 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 16:19:23 -0700 (MST) Subject: [Rxtx] When is the DATA_AVAILABLE event dispatched In-Reply-To: <4419EEE7.9060602@tiscalinet.be> References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> <4419EEE7.9060602@tiscalinet.be> Message-ID: On Thu, 16 Mar 2006, Vince wrote: > Trent Jarvi wrote: >> This is going to require recompiling rxtx. We don't have anything you can >> tinker with without recompiling the .dll. I can try that for you tonight. > > Just a note I'm thinking of right now : can you confirm that RxTx follows > Sun's default behaviour regarding enableReceiveTimeout(), that is, receive > timeout is not enabled by default ? > Because the reason could also be that the DATA_AVAILABLE is dispatched > quickly enough, but then the inStream.read(buff) blocks for a certain time > before returning... > I admit I don't explicitely call disableReceiveTimeout()... The following is called with the port is opened. It stomps on the structure and sets it. int configure_port( int fd ) { struct termios ttyset; if( fd < 0 ) goto fail; if( tcgetattr( fd, &ttyset ) < 0 ) goto fail; ttyset.c_iflag = INPCK; ttyset.c_lflag = 0; ttyset.c_oflag = 0; ttyset.c_cflag = CREAD | CS8 | CLOCAL; ttyset.c_cc[ VMIN ] = 0; ttyset.c_cc[ VTIME ] = 0; VMIN is threshold 0 VTIME is timeout 0 Unless there is a bug in the win32 layer, thats how rxtx opens the port. They should both be 'disabled.' I'm not sure why we have 20 ms sleeps, thats a excessive for just keeping CPU use down. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Thu Mar 16 19:34:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 16 Mar 2006 19:34:31 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. Message-ID: The mail-list tends to attract those with problems. I thought I'd mention what we are doing right and could improve upon. We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. Thats about 175 new users per day. This does not include projects that bundle rxtx and ship their own copy. One of the problems is people having problems tend to avoid mentioning it. Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are more. How do we improve that? Our wiki needs help, our javadoc needs help(!!!) but we are helping many people and projects. I see many people are hitting the new wiki. We don't have much there. I imagine some short examples of programming with rxtx would be nice. There are rough examples in the contrib directory with the rxtx source to start. I'm going to be able to dig deeper into some bugs but will have less time for the web content. If you have time this weekend, toss something onto the wiki. If you have a project you would like people to see, create a new page and put it there. Thanks everyone and have Fun :) -- Trent Jarvi tjarvi at qbang.org From daniel.blackburn at ntlworld.com Fri Mar 17 04:23:38 2006 From: daniel.blackburn at ntlworld.com (Daniel Blackburn) Date: Fri, 17 Mar 2006 11:23:38 +0000 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: References: Message-ID: <441A9C3A.7050300@ntlworld.com> Congratulations on all the downloads. I guess quite a few of these downloads will be Windows users looking for an alternative after sun dropped Windows support. That's why I made the switch so I thought Id give you my opinion on the Wiki/docs/etc. The project is great but the website and most documentation for the project is confusing as hell. I think that's because there's no clear line drawn between people who will just want to install the jar and use that and people compiling their own version and cross compiling etc. The installation file on the Wiki for example mentions lots of info on building rather than installing. I may be misunderstanding this here though and you may have to compile to get started under Linux? But that brings me nicely onto my next point. Different platforms need different documentation clearly separated. At the moment it all seems thrown in together to me. Please don't flame me as It's just my opinion and I'm only emailing it in to try and help. My situation is probably quite similar to a lot of other people switching to RXTX at the moment. In the end I gave up on the website and Wiki and turned to google. Where I found this : http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 Which told me everything I needed to know. Like I say RXTX itself is great though. Keep up the good work, I don't know where I'd be without it. Well I do actually, not using Java anymore :/ Cheers, Dan Trent Jarvi wrote: > > The mail-list tends to attract those with problems. I thought I'd > mention what we are doing right and could improve upon. > > We have passed 32000 downloads at rxtx.org since Sep 25 2005 today. > Thats about 175 new users per day. This does not include projects > that bundle rxtx and ship their own copy. > > One of the problems is people having problems tend to avoid mentioning > it. > Our Bugzilla has 2 or 3 bugs filed for rxtx. Obviously there are > more. How do we improve that? > > Our wiki needs help, our javadoc needs help(!!!) but we are helping > many people and projects. I see many people are hitting the new wiki. > We don't have much there. I imagine some short examples of > programming with rxtx would be nice. There are rough examples in the > contrib directory with the rxtx source to start. > > I'm going to be able to dig deeper into some bugs but will have less > time for the web content. > > If you have time this weekend, toss something onto the wiki. If you > have a project you would like people to see, create a new page and put > it there. > > Thanks everyone and have Fun :) > > -- > Trent Jarvi > tjarvi at qbang.org > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Fri Mar 17 05:37:04 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 05:37:04 -0700 (MST) Subject: [Rxtx] [Hack] 14400 Baud for w32 Message-ID: As I prepare to move, I'm placing a couple hacks up to help people. These will be fixed properly later. The first is 14400 baud for w32. No matter what you do with this lib, it will communicate at 14400 baud. Some scales use this rate. Fixing this properly is difficult because of the way rxtx works but will be fixed properly in 2.1-8. Binary is available for rxtx-2.1-7 at: ftp://ftp.qbang.org/pub/rxtx/hacks/14400-baud Index: src/termios.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/termios.c,v retrieving revision 1.9.2.56 diff -r1.9.2.56 termios.c 554c554 < dcb->BaudRate = CBR_9600 ; --- > dcb->BaudRate = CBR_14400 ; 773c773 < cfsetospeed( ttyset, B9600 ); --- > cfsetospeed( ttyset, CBR_14400 ); 1875c1875 < s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); --- > s_termios->c_ispeed = 14400; //CBR_to_B( dcb->BaudRate ); 2347a2348,2349 > > dcb.BaudRate = CBR_14400; From tjarvi at qbang.org Fri Mar 17 06:03:29 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:03:29 -0700 (MST) Subject: [Rxtx] [Hack] Faster Event Notification. In-Reply-To: References: <4419BBB6.6060103@tiscalinet.be> <4419CEFE.2010303@tiscalinet.be> Message-ID: This is the second hack. It has not been tested but is intended to speed up event notification. It may cause excess CPU usage or other problems. It should remove the problem seen where 20 ms can pass between events in some circumstances. Further testing is required before this goes into HEAD for the next release. The binary can be found at: ftp://ftp.qbang.org/pub/rxtx/hacks/fast_events/ One can see what was modified and perhaps tune it more to their needs. If you can't build w32 binaries but would like to, ask me for a 'bob account' off the list. Index: src/SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.187 diff -u -r1.46.2.187 SerialImp.c --- src/SerialImp.c 29 Jan 2006 22:19:04 -0000 1.46.2.187 +++ src/SerialImp.c 17 Mar 2006 12:52:31 -0000 @@ -3934,14 +3934,7 @@ if(!eis->eventflags[SPE_DATA_AVAILABLE] ) { report_verbose("report_serial_events: ignoring DATA_AVAILABLE\n"); -/* - report("."); -*/ - usleep(20000); -#if !defined(__sun__) - /* FIXME: No time to test on all OS's for production */ - usleep(20000); -#endif /* !__sun__ */ + usleep(5000); return; } report("report_serial_events: sending DATA_AVAILABLE\n"); @@ -3953,7 +3946,7 @@ #if !defined(__sun__) #endif /* !__sun__ */ } - usleep(20000); + usleep(5000); } } @@ -4111,16 +4104,12 @@ usleep(5000); */ eis.ret=1; - while( i++ < 5 ) + if(eis.eventflags[SPE_DATA_AVAILABLE] ) { - if(eis.eventflags[SPE_DATA_AVAILABLE] ) + if( port_has_changed_fionread( &eis ) ) { - if( port_has_changed_fionread( &eis ) ) - { - send_event( &eis, SPE_DATA_AVAILABLE, 1 ); - } + send_event( &eis, SPE_DATA_AVAILABLE, 1 ); } - usleep(1000); } i = 0; #endif /* WIN32 */ From tjarvi at qbang.org Fri Mar 17 06:41:03 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 06:41:03 -0700 (MST) Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: <441A9C3A.7050300@ntlworld.com> References: <441A9C3A.7050300@ntlworld.com> Message-ID: On Fri, 17 Mar 2006, Daniel Blackburn wrote: > Congratulations on all the downloads. I guess quite a few of these downloads > will be Windows users looking for an alternative after sun dropped Windows > support. That's why I made the switch so I thought Id give you my opinion > on the Wiki/docs/etc. > > The project is great but the website and most documentation for the project > is confusing as hell. I think that's because there's no clear line drawn > between people who will just want to install the jar and use that and people > compiling their own version and cross compiling etc. The installation file on > the Wiki for example mentions lots of info on building rather than > installing. I may be misunderstanding this here though and you may have to > compile to get started under Linux? But that brings me nicely onto my next > point. Different platforms need different documentation clearly separated. > At the moment it all seems thrown in together to me. Hi Daniel Thanks. One does not have to compile rxtx to install linux but compiling does perform many checks and installs properly. It is a tossup which is easier. Doug is working on a better solution for most platforms but it is not an easy problem. The rxtx INSTALL is showing its age but it is better than nothing. The documentation certainly is thrown together. Some of your comments will not be hard to do. For instance creating seperate pages where install instructions can be for each OS. There could also be a page for Doug's installer. You could just create the blank pages with a comment about what you expect there and we can fill it in over time. Or maybe someone will fill it in after doing an install. > > Please don't flame me as It's just my opinion and I'm only emailing it in to > try and help. My situation is probably quite similar to a lot of other > people switching to RXTX at the moment. In the end I gave up on the website > and Wiki and turned to google. Where I found this : > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > Which told me everything I needed to know. Thats a nice post on Sun's web site for rxtx users. What I'm facing is decreasing free time and increasing users. With the wiki, the hope is users can lay out what they want to see and we can help on the technical issues that may come up. The rxtx documentation was never great. But the sad fact is I will have even less time for it. Initially, I will have more time for bugs that show up. I'm fairly sure many rxtx users get frustrated with the documentation. What I'm trying to do since I wont be able to create the documentation is give users a chance to improve it. Right now, I see many users hit the front page of the wiki and move on. Maybe if people add a little more content or lay out the front page the way they expect it to look, we will get more activity there. Anyone that wants to create an account on the wiki can edit it. There is nothing final there. If you think you could help, it would be greatly appreciated. I'm especially interested in seeing users have more say there by simply clicking on edit. -- Trent Jarvi tjarvi at qbang.org From j.a.horsmeier at wanadoo.nl Fri Mar 17 07:14:05 2006 From: j.a.horsmeier at wanadoo.nl (Jos A. Horsmeier) Date: Fri, 17 Mar 2006 15:14:05 +0100 Subject: [Rxtx] Downloads: 32000 in ~6 months. In-Reply-To: Message-ID: Trent Jarvi wrote: > On Fri, 17 Mar 2006, Daniel Blackburn wrote: > > In the end I gave up on the website and Wiki and turned to google. > > Where I found this : > > http://forum.java.sun.com/thread.jspa?forumID=31&threadID=698876 > > Which told me everything I needed to know. > > Thats a nice post on Sun's web site for rxtx users. That post on Sun's site was mine; it isn't up-to-date anymore because it was based on a pre20 release which contained just three files in the .zip for MS Windows users. When I find some time I'll cook up some simple step by step installation instructions for MS Windows and put it on the rxtx wiki pages. kind regards, Jos From joachim at buechse.de Fri Mar 17 08:18:01 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 16:18:01 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) Message-ID: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Good day, [If you want to read this very quickly, go right to the Suggestions at the end] I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm giving you the short story: The code snippet try { CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier (_selectedPort); if (cpi.isCurrentlyOwned()) { System.out.println(" ** port in use by " + cpi.getCurrentOwner()); } _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); } catch (NoSuchPortException nspe) { // this should never happen System.out.println(" ** no such port"); return; } catch (PortInUseException piue) { System.out.println(" ** port could not be opened"); piue.printStackTrace(); return; } would return ** port could not be opened gnu.io.PortInUseException: Unknown Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at PortWindow.openPort(PortWindow.java:98) ... Well, not a very strong indication to what was actually going on. In fact, the problem was that the directory /var/lock did not exist. Some findings: ---- - /var/lock does not exist by default on OS X - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not contain a script which creates /var/lock (I did not use the installer but I dissected it with Pacifist) - the INSTALL file in the bins package talks about a file fixperm.sh which is not included. no further information is provided what this script does - the file fixperm.sh is only in the src tarball and still checks for /var/spool/uucp furthermore it wants to add the current user to the group uucp. - the default installation suggestion (for Mac and others) seems like a rather intrusive choice. /Library/Java/Extensions is global and hence might lead to version conflicts, however RXTX will work just fine if RXTXcomm.jar is in the classpath (which is obvious to any java programmer) and librxtxSerial.jnilib is in java.library.path (which includes the current (launch) directory). [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] Suggestions: ---- - the implementation should check if it can write to the lock directory and if not produce a meaningfull error message containing the lock directory path (maybe with a distinction of not existant / not writable) - a description should be added to bin-tarball/INSTALL that the /var/ lock directory must exist and be writable on the Mac - the file bin-tarball/INSTALL should be more descriptive regarding JNI loading (ie mentioning java.library.path and current directory) - the script contrib/fixperm.sh should be removed. it is out of date and overly specific regarding the uucp group. in fact as there is no default permission, /var/lock "could" be world writable it is not up to RXTX to define this... As a new user, I dont feel in a position to check in changes to the CVS tree. Should I? Regards, Joachim From tjarvi at qbang.org Fri Mar 17 08:35:31 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 08:35:31 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > > As a new user, I dont feel in a position to check in changes to the CVS tree. > Should I? > Hi Joachim The way CVS works is you put the patch here and give people time to comment. If there are no problems the Mac OS X maintainer (Dmitry Markman) will put the fixes in CVS and give you credit. -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 09:18:21 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 17:18:21 +0100 Subject: [Rxtx] RFC: Locking Message-ID: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> RXTX currently uses lock files to avoid conflicts when accessing serial ports. Browsing the net a little bit I found, that at least Solaris and MacOS use a different approach to assure exclusive access to a port. This seems to be the general POSSIX approach. Basicly, after successfully opening a port the addtional call if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... guarentees, that no other process will open the port. This seems like a much better solution as it will be enforced by the system and does not rely on naming conventions for lock files (nobody says, that a lock file couldnt be created/checked as well, though). Apple has a nice sample how the port should be opened: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html Apparently this was added to Suns javax.comm implementation: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 Now, RXTX seems to be using a C++ class BSerialPort which does not include this code (verified by a small check on OS X). Unfortunately C ++ is incompatible with my brain, so maybe somebody without this incompatibility could add the lines... (which would involve getting the wrapped file descriptor from the BSerialPort class). Regards, Joachim From mail at willicon.de Fri Mar 17 09:29:20 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 17:29:20 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <441AE3E0.2030503@willicon.de> @All I've the same problem of the "description of installation" of my users (on several platforms). So I develop a short description of the RXTX installation process - of the 4 main platforms (Win, OSX, Linux and Solaris). Sorry, it's till now in German, but I believe You understand the structure. First I describe the general installation based from the Java home dictionary. The second part describe the installation based on the current (launch) directory. Link: http://www.chris-werx.de/Installation.html If I have from all platforms the confirm that it works, than I put it into the Wiki. Hans Joachim Buechse schrieb: > Good day, > > [If you want to read this very quickly, go right to the Suggestions at > the end] > > I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm > giving you the short story: > > The code snippet > > try { > CommPortIdentifier cpi= > CommPortIdentifier.getPortIdentifier(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + > cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > > would return > > > ** port could not be opened > gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > > Well, not a very strong indication to what was actually going on. In > fact, the problem was that the directory /var/lock did not exist. > > Some findings: > ---- > > - /var/lock does not exist by default on OS X > - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not > contain a script which creates /var/lock (I did not use the installer > but I dissected it with Pacifist) > - the INSTALL file in the bins package talks about a file fixperm.sh > which is not included. no further information is provided what this > script does > - the file fixperm.sh is only in the src tarball and still checks for > /var/spool/uucp furthermore it wants to add the current user to the > group uucp. > - the default installation suggestion (for Mac and others) seems like > a rather intrusive choice. /Library/Java/Extensions is global and > hence might lead to version conflicts, however RXTX will work just > fine if RXTXcomm.jar is in the classpath (which is obvious to any java > programmer) and librxtxSerial.jnilib is in java.library.path (which > includes the current (launch) directory). [RXTXcomm.jar might even try > to locate librxtxSerial.jnilib and load it with the > Sytem.load(fullpath).] > > > Suggestions: > ---- > > - the implementation should check if it can write to the lock > directory and if not produce a meaningfull error message containing > the lock directory path (maybe with a distinction of not existant / > not writable) > - a description should be added to bin-tarball/INSTALL that the > /var/lock directory must exist and be writable on the Mac > - the file bin-tarball/INSTALL should be more descriptive regarding > JNI loading (ie mentioning java.library.path and current directory) > - the script contrib/fixperm.sh should be removed. it is out of date > and overly specific regarding the uucp group. in fact as there is no > default permission, /var/lock "could" be world writable it is not up > to RXTX to define this... > > > As a new user, I dont feel in a position to check in changes to the > CVS tree. Should I? > > Regards, > Joachim > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/15a7b87b/attachment-0011.html From tjarvi at qbang.org Fri Mar 17 10:27:46 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 10:27:46 -0700 (MST) Subject: [Rxtx] RFC: Locking In-Reply-To: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> References: <39C9CE3C-F128-46AD-9ED5-B99CDD7D1F6E@buechse.de> Message-ID: On Fri, 17 Mar 2006, Joachim Buechse wrote: > RXTX currently uses lock files to avoid conflicts when accessing serial > ports. > > Browsing the net a little bit I found, that at least Solaris and MacOS > use a different approach to assure exclusive access to a port. This seems > to be the general POSSIX approach. Basicly, after successfully opening a > port the addtional call > > if (ioctl(fileDescriptor, TIOCEXCL) == kMyErrReturn) { ... > > guarentees, that no other process will open the port. This seems like a > much better solution as it will be enforced by the system and does not > rely on naming conventions for lock files (nobody says, that a lock file > couldnt be created/checked as well, though). > > Apple has a nice sample how the port should be opened: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/ > WorkingWSerial/WWSerial_SerialDevs/chapter_2_section_8.html > > Apparently this was added to Suns javax.comm implementation: > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4660064 > > Now, RXTX seems to be using a C++ class BSerialPort which does not > include this code (verified by a small check on OS X). Unfortunately C++ > is incompatible with my brain, so maybe somebody without this > incompatibility could add the lines... (which would involve getting the > wrapped file descriptor from the BSerialPort class). > Joachim I think this is a good idea for Mac OS X especially but also general use. See also http://mailman.qbang.org/cgi-bin/htsearch?config=htdig&restrict=&exclude=&method=and&format=builtin-long&sort=score&words=TIOCEXCL -- Trent Jarvi tjarvi at qbang.org From joachim at buechse.de Fri Mar 17 11:17:05 2006 From: joachim at buechse.de (Joachim Buechse) Date: Fri, 17 Mar 2006 19:17:05 +0100 Subject: [Rxtx] RFC: Handling of InterruptedException Message-ID: <2C2F5EC2-0D8B-4921-B324-13005978FBA9@buechse.de> I have looked at some of the code and found several places like this: synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { } } This is an incorrect implementation. Doing it this way, effectively disable the mechanism of Thread.interrupt(). wait() checks it the interrupted flag is set on the current thread (via Thread.interrupted()) and if so it is cleared(!) and the InterruptedException is thrown. If the InterruptedException can not be forwarded, one has to re-"set" the flag via Thread.currentThread ().interrupt(). Hence the correct implementation is synchronized (Sync) { fireOwnershipEvent (CommPortOwnershipListener.PORT_OWNERSHIP_REQUESTED); try { wait(i); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } This way the interrupted flag is set and can be seen by later invocations of wait or Thread.isInterrupted() or Thread.interrupted(). Suggestion --- I suggest to systematicly change all code from the current implementation to the correct implementation. From dmarkman at mac.com Fri Mar 17 11:57:05 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 13:57:05 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> Message-ID: <12094005.1142621825757.JavaMail.dmarkman@mac.com> I think it's generally good idea to check latest available version before starting to make conclusions latest installer (it's at least few weeks old) has script for creating /var/lock directory and it has universal binaries too however implementing different locking mechanism (via ioctl) as was suggested on that list could be good idea (it should be investigated) BTW: you don't need any 3rd party software to investigate installer don't forget rxtx is open source software and everything is available from the CVS (tarball has latest stuff too) it has apple's packagemaker project file it has all scripts - everything you need bottom line: don't hack :-) just download it and enjoy if you see the bug report it or fix it by yourself regards On Friday, March 17, 2006, at 10:27AM, Joachim Buechse wrote: >Good day, > >[If you want to read this very quickly, go right to the Suggestions >at the end] > >I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >giving you the short story: > >The code snippet > > try { > CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >(_selectedPort); > if (cpi.isCurrentlyOwned()) { > System.out.println(" ** port in use by " + cpi.getCurrentOwner()); > } > _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); > } catch (NoSuchPortException nspe) { > // this should never happen > System.out.println(" ** no such port"); > return; > } catch (PortInUseException piue) { > System.out.println(" ** port could not be opened"); > piue.printStackTrace(); > return; > } > >would return > > > ** port could not be opened >gnu.io.PortInUseException: Unknown Application > at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at PortWindow.openPort(PortWindow.java:98) > ... > >Well, not a very strong indication to what was actually going on. In >fact, the problem was that the directory /var/lock did not exist. > >Some findings: >---- > >- /var/lock does not exist by default on OS X >- the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >contain a script which creates /var/lock (I did not use the installer >but I dissected it with Pacifist) >- the INSTALL file in the bins package talks about a file fixperm.sh >which is not included. no further information is provided what this >script does >- the file fixperm.sh is only in the src tarball and still checks >for /var/spool/uucp furthermore it wants to add the current user to >the group uucp. >- the default installation suggestion (for Mac and others) seems like >a rather intrusive choice. /Library/Java/Extensions is global and >hence might lead to version conflicts, however RXTX will work just >fine if RXTXcomm.jar is in the classpath (which is obvious to any >java programmer) and librxtxSerial.jnilib is in java.library.path >(which includes the current (launch) directory). [RXTXcomm.jar might >even try to locate librxtxSerial.jnilib and load it with the >Sytem.load(fullpath).] > > >Suggestions: >---- > >- the implementation should check if it can write to the lock >directory and if not produce a meaningfull error message containing >the lock directory path (maybe with a distinction of not existant / >not writable) >- a description should be added to bin-tarball/INSTALL that the /var/ >lock directory must exist and be writable on the Mac >- the file bin-tarball/INSTALL should be more descriptive regarding >JNI loading (ie mentioning java.library.path and current directory) >- the script contrib/fixperm.sh should be removed. it is out of date >and overly specific regarding the uucp group. in fact as there is no >default permission, /var/lock "could" be world writable it is not up >to RXTX to define this... > > >As a new user, I dont feel in a position to check in changes to the >CVS tree. Should I? > >Regards, >Joachim > >_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD From dmarkman at mac.com Fri Mar 17 12:01:54 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 14:01:54 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441AE3E0.2030503@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> Message-ID: <12531986.1142622114996.JavaMail.dmarkman@mac.com> I'm just curious why installer I created for mac os x (latest tarball contains it) isn't used (or mentioned) in that installation tips it looks like it works fine if it's not I'd like to see reproducable case On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/28acd819/attachment-0011.html From mail at willicon.de Fri Mar 17 14:13:24 2006 From: mail at willicon.de (WILLICon) Date: Fri, 17 Mar 2006 22:13:24 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <12531986.1142622114996.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> Message-ID: <441B2674.9010409@willicon.de> Dimitry, where can I find the installer. I'm not a OSX user, please describe it for a stupid windows user of RXTX :-) I've a dream of a jnlp application, what is doing all the jobs for the 4 major platforms. Hans Dmitry Markman schrieb: > I'm just curious > why installer I created for mac os x (latest tarball contains it) > isn't used (or mentioned) in that installation tips > > it looks like it works fine > if it's not I'd like to see reproducable case > > > > > On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > @All > > I've the same problem of the "description of installation" of my users > (on several platforms). > > So I develop a short description of the RXTX installation process - of > the 4 main platforms (Win, OSX, Linux and Solaris). > > Sorry, it's till now in German, but I believe You understand the > structure. First I describe the general installation based from the > Java home dictionary. The second part describe the installation based > on the current (launch) directory. > > Link: http://www.chris-werx.de/Installation.html > > If I have from all platforms the confirm that it works, than I put it > into the Wiki. > > Hans > > > > Joachim Buechse schrieb: >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= >> CommPortIdentifier.getPortIdentifier(_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + >> cpi.getCurrentOwner()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks for >> /var/spool/uucp furthermore it wants to add the current user to the >> group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the >> /var/lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/f0dfe166/attachment-0011.html From dmarkman at mac.com Fri Mar 17 15:32:12 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 17:32:12 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B2674.9010409@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> Message-ID: <13577405.1142634732776.JavaMail.dmarkman@mac.com> Hans if you want to use rxtx from jnlp, then it's different story 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag (or use othe mechanism) to check is rxtx installed b) if not extract installer from your jar file and run it via System.exec 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but in addition you have to run the script. that script requires system privileges I'm not sure how to do that from java I'll try to play with that today at home if I'll be successful I'll let you know On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > ><>_______________________________________________ >Rxtx mailing list >Rxtx at qbang.org >http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman, PhD -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/92810d35/attachment-0011.html From mail at willicon.de Fri Mar 17 16:08:50 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 00:08:50 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <13577405.1142634732776.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> Message-ID: <441B4182.8010407@willicon.de> Dimitry, thanks for Your answer. First, I need a external installer for the 4 major platforms. If it's possible, than as jnlp. My dream is ONE jnlp installer for all the platforms. But for the first time it would be helpfully, if i had one external installer for each platform (with a link on it). Hans PS: Could it be possible, to put all installer out of the development package into a separate dictionary? It could not be the intention, that every non developer user (-> simple user) must download the development package and find and extract the right installer for his platform. Dmitry Markman schrieb: > Hans > > if you want to use rxtx from jnlp, then it's different story > > 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) > a) put some flag (or use othe mechanism) to check is rxtx installed > b) if not extract installer from your jar file and run it via System.exec > > 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but > in addition you have to run the script. that script requires system privileges > I'm not sure how to do that from java > I'll try to play with that today at home > if I'll be successful I'll let you know > > > > On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: > > >> <>_______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> >> > > > Dmitry Markman, PhD > > > ------------------------------------------------------------------------ > > Dimitry, > > where can I find the installer. > I'm not a OSX user, please describe it for a stupid windows user of > RXTX :-) > > I've a dream of a jnlp application, what is doing all the jobs for the > 4 major platforms. > > Hans > > > Dmitry Markman schrieb: >> I'm just curious >> why installer I created for mac os x (latest tarball contains it) >> isn't used (or mentioned) in that installation tips >> >> it looks like it works fine >> if it's not I'd like to see reproducable case >> >> >> >> >> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> >> >> Dmitry Markman, PhD >> >> >> ------------------------------------------------------------------------ >> >> @All >> >> I've the same problem of the "description of installation" of my >> users (on several platforms). >> >> So I develop a short description of the RXTX installation process - >> of the 4 main platforms (Win, OSX, Linux and Solaris). >> >> Sorry, it's till now in German, but I believe You understand the >> structure. First I describe the general installation based from the >> Java home dictionary. The second part describe the installation based >> on the current (launch) directory. >> >> Link: http://www.chris-werx.de/Installation.html >> >> If I have from all platforms the confirm that it works, than I put it >> into the Wiki. >> >> Hans >> >> >> >> Joachim Buechse schrieb: >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= >>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + >>> cpi.getCurrentOwner()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like a rather intrusive choice. /Library/Java/Extensions is global >>> and hence might lead to version conflicts, however RXTX will work >>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>> any java programmer) and librxtxSerial.jnilib is in >>> java.library.path (which includes the current (launch) directory). >>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and load >>> it with the Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the >>> /var/lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/264f6c24/attachment-0002.html From tjarvi at qbang.org Fri Mar 17 18:54:02 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 17 Mar 2006 18:54:02 -0700 (MST) Subject: [Rxtx] Re: getting checkin access to CVS repository (fwd) Message-ID: For those wondering. This email exchange was off the list so I removed the names, but this is how things work. > Hell Trent, > > I would like to correct some problems with the current implementation. > > - Is there a "suggestions" trunk? > - Which username/password can I use to commit changes > Hi With CVS you have to suggest several good patches to the mail-list before you get write access. That means everyone knows you wont (usually) break things by accident. We are not looking to see how smart you are or anything. There is an unspoken process in open source and we are watching for that. Right now there are two people with write access. Dmitry Markman and myself. By a freak of nature it turns out we both will be working at the same company but that was not intentional. I will be announcing changes in the rxtx leadership shortly to account for that 'accident' to make sure the following process stays neutral. So what you do after you make *small* patches for *specific* problems (not "this fixes several things I found") just run "cvs diff -u > my.patch" and post it to the list as: Subject: [Patch] Fix a typo in SerialImp.c eventLoop() This fixes a typo I found [include patch here inline - dont attach it] If you have several things you would like to patch post them as a series with the first post being a summary: Subject: [Patch 1/4] Fix several problems with port ownership Subject: [Patch 2/4] Remove totally braindead assumptions. ... Then everyone will look and make comments. No tricks. Even I do that so all users and companies can see each change and why its done. Anyone may object if they think it is wrong. Then we discuss it and decide. It is slower but with more and more users and companies depending upon rxtx it is important. If your patches are generally accepted and we get tired of putting them in for you, we will give you cvs access. You will still post to the list and wait for comments. By then you will understand that is important. Either way you will get credit. The rxtx project has been giving credit for all changes since the beginning. Look at ChangeLog in the source. Even those with write access should post their suggested changes to the list first. Just like I did with the [Hack] patches earlier today. Those are not in CVS as we would not do that. The problem is many people have rxtx working for their needs. They watch the list not CVS to know when things may break. We have to have checks. It wasn't always like this. If you are a new project just getting started, its more important to find people you trust and give access. At this point, rxtx is important enough for enough people that I too am stepping back from old ways. It's hard :) -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Fri Mar 17 19:34:14 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 17 Mar 2006 21:34:14 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441B4182.8010407@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> Message-ID: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> we certainly have such an installer for mac os x I have no idea about linux (linux people probably don't need any installer though) it would be nice to have windows installer I think On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > Dimitry, > > thanks for Your answer. > > First, I need a external installer for the 4 major platforms. If > it's possible, than as jnlp. > My dream is ONE jnlp installer for all the platforms. > > But for the first time it would be helpfully, if i had one external > installer for each platform (with a link on it). > > Hans > > PS: Could it be possible, to put all installer out of the > development package into a separate dictionary? It could not be the > intention, that every non developer user (-> simple user) must > download the development package and find and extract the right > installer for his platform. > > > > Dmitry Markman schrieb: >> Hans >> >> if you want to use rxtx from jnlp, then it's different story >> >> 1. you can put installer into the jar file (you can find installer >> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >> a) put some flag (or use othe mechanism) to check is rxtx >> installed >> b) if not extract installer from your jar file and run it via >> System.exec >> >> 2. you can put jar file and jnilib file into your jar file and do >> exactly what I say yearlier but >> in addition you have to run the script. that script requires >> system privileges >> I'm not sure how to do that from java >> I'll try to play with that today at home >> if I'll be successful I'll let you know >> >> >> >> On Friday, March 17, 2006, at 04:22PM, WILLICon >> wrote: >> >> >>> <>_______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >>> >> Dmitry Markman, PhD >> >> >> >> Dimitry, >> >> where can I find the installer. >> I'm not a OSX user, please describe it for a stupid windows user >> of RXTX :-) >> >> I've a dream of a jnlp application, what is doing all the jobs for >> the 4 major platforms. >> >> Hans >> >> >> Dmitry Markman schrieb: >>> I'm just curious >>> why installer I created for mac os x (latest tarball contains it) >>> isn't used (or mentioned) in that installation tips >>> >>> it looks like it works fine >>> if it's not I'd like to see reproducable case >>> >>> >>> >>> >>> On Friday, March 17, 2006, at 11:39AM, WILLICon >>> wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> >>> @All >>> >>> I've the same problem of the "description of installation" of my >>> users (on several platforms). >>> >>> So I develop a short description of the RXTX installation process >>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>> >>> Sorry, it's till now in German, but I believe You understand the >>> structure. First I describe the general installation based from >>> the Java home dictionary. The second part describe the >>> installation based on the current (launch) directory. >>> >>> Link: http://www.chris-werx.de/Installation.html >>> >>> If I have from all platforms the confirm that it works, than I >>> put it into the Wiki. >>> >>> Hans >>> >>> >>> >>> Joachim Buechse schrieb: >>>> Good day, >>>> >>>> [If you want to read this very quickly, go right to the >>>> Suggestions at the end] >>>> >>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>> I'm giving you the short story: >>>> >>>> The code snippet >>>> >>>> try { >>>> CommPortIdentifier cpi= >>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>> if (cpi.isCurrentlyOwned()) { >>>> System.out.println(" ** port in use by " + >>>> cpi.getCurrentOwner()); >>>> } >>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>> } catch (NoSuchPortException nspe) { >>>> // this should never happen >>>> System.out.println(" ** no such port"); >>>> return; >>>> } catch (PortInUseException piue) { >>>> System.out.println(" ** port could not be opened"); >>>> piue.printStackTrace(); >>>> return; >>>> } >>>> >>>> would return >>>> >>>> >>>> ** port could not be opened >>>> gnu.io.PortInUseException: Unknown Application >>>> at gnu.io.CommPortIdentifier.open >>>> (CommPortIdentifier.java:354) >>>> at PortWindow.openPort(PortWindow.java:98) >>>> ... >>>> >>>> Well, not a very strong indication to what was actually going >>>> on. In fact, the problem was that the directory /var/lock did >>>> not exist. >>>> >>>> Some findings: >>>> ---- >>>> >>>> - /var/lock does not exist by default on OS X >>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>> not contain a script which creates /var/lock (I did not use the >>>> installer but I dissected it with Pacifist) >>>> - the INSTALL file in the bins package talks about a file >>>> fixperm.sh which is not included. no further information is >>>> provided what this script does >>>> - the file fixperm.sh is only in the src tarball and still >>>> checks for /var/spool/uucp furthermore it wants to add the >>>> current user to the group uucp. >>>> - the default installation suggestion (for Mac and others) seems >>>> like a rather intrusive choice. /Library/Java/Extensions is >>>> global and hence might lead to version conflicts, however RXTX >>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>> in java.library.path (which includes the current (launch) >>>> directory). [RXTXcomm.jar might even try to locate >>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>> >>>> >>>> Suggestions: >>>> ---- >>>> >>>> - the implementation should check if it can write to the lock >>>> directory and if not produce a meaningfull error message >>>> containing the lock directory path (maybe with a distinction of >>>> not existant / not writable) >>>> - a description should be added to bin-tarball/INSTALL that the / >>>> var/lock directory must exist and be writable on the Mac >>>> - the file bin-tarball/INSTALL should be more descriptive >>>> regarding JNI loading (ie mentioning java.library.path and >>>> current directory) >>>> - the script contrib/fixperm.sh should be removed. it is out of >>>> date and overly specific regarding the uucp group. in fact as >>>> there is no default permission, /var/lock "could" be world >>>> writable it is not up to RXTX to define this... >>>> >>>> >>>> As a new user, I dont feel in a position to check in changes to >>>> the CVS tree. Should I? >>>> >>>> Regards, >>>> Joachim >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060317/b8146825/attachment-0011.html From tjarvi at qbang.org Sat Mar 18 00:23:06 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 00:23:06 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: On Fri, 17 Mar 2006, Dmitry Markman wrote: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > The following is outside of what doug is working on which is very cool for mulitple OS's. There are Linux installers but there isn't a clear solution. :( A solution would not involve rxtx.org directy but rather a repackaging of what we offer. Many distros now package rxtx in Linux. I think thats best. Debian and gentoo do this already. There are also more generic solutions. I dont think the end solution to rxtx Linux installs is fixing our packages. We just need to be a stable target; we need to have good source code. With Linux you also have to remember there is Java [TM Sun] and java - that open source stuff. I'm in favor of both but would like to see an ISO standard. -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 00:47:57 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 08:47:57 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> Message-ID: <441BBB2D.8030305@willicon.de> Dimitry, I look a little bit around in MACOSX_IDE. I did not found any OSX installer. Which is the filename. A Installer for Linux and Windows is no prop. Hans Dmitry Markman schrieb: > we certainly have such an installer for mac os x > I have no idea about linux (linux people probably don't need any > installer though) > it would be nice to have windows installer I think > > On Mar 17, 2006, at 6:08 PM, WILLICon wrote: > >> Dimitry, >> >> thanks for Your answer. >> >> First, I need a external installer for the 4 major platforms. If it's >> possible, than as jnlp. >> My dream is ONE jnlp installer for all the platforms. >> >> But for the first time it would be helpfully, if i had one external >> installer for each platform (with a link on it). >> >> Hans >> >> PS: Could it be possible, to put all installer out of the development >> package into a separate dictionary? It could not be the intention, >> that every non developer user (-> simple user) must download the >> development package and find and extract the right installer for his >> platform. >> >> >> >> Dmitry Markman schrieb: >>> Hans >>> >>> if you want to use rxtx from jnlp, then it's different story >>> >>> 1. you can put installer into the jar file (you can find installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) >>> a) put some flag (or use othe mechanism) to check is rxtx installed >>> b) if not extract installer from your jar file and run it via System.exec >>> >>> 2. you can put jar file and jnilib file into your jar file and do exactly what I say yearlier but >>> in addition you have to run the script. that script requires system privileges >>> I'm not sure how to do that from java >>> I'll try to play with that today at home >>> if I'll be successful I'll let you know >>> >>> >>> >>> On Friday, March 17, 2006, at 04:22PM, WILLICon wrote: >>> >>> >>>> <>_______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>>> >>> Dmitry Markman, PhD >>> >>> >>> ------------------------------------------------------------------------ >>> >>> Dimitry, >>> >>> where can I find the installer. >>> I'm not a OSX user, please describe it for a stupid windows user of >>> RXTX :-) >>> >>> I've a dream of a jnlp application, what is doing all the jobs for >>> the 4 major platforms. >>> >>> Hans >>> >>> >>> Dmitry Markman schrieb: >>>> I'm just curious >>>> why installer I created for mac os x (latest tarball contains it) >>>> isn't used (or mentioned) in that installation tips >>>> >>>> it looks like it works fine >>>> if it's not I'd like to see reproducable case >>>> >>>> >>>> >>>> >>>> On Friday, March 17, 2006, at 11:39AM, WILLICon wrote: >>>> >>>> >>>>> <>_______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>>> >>>> Dmitry Markman, PhD >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> @All >>>> >>>> I've the same problem of the "description of installation" of my >>>> users (on several platforms). >>>> >>>> So I develop a short description of the RXTX installation process - >>>> of the 4 main platforms (Win, OSX, Linux and Solaris). >>>> >>>> Sorry, it's till now in German, but I believe You understand the >>>> structure. First I describe the general installation based from the >>>> Java home dictionary. The second part describe the installation >>>> based on the current (launch) directory. >>>> >>>> Link: http://www.chris-werx.de/Installation.html >>>> >>>> If I have from all platforms the confirm that it works, than I put >>>> it into the Wiki. >>>> >>>> Hans >>>> >>>> >>>> >>>> Joachim Buechse schrieb: >>>>> Good day, >>>>> >>>>> [If you want to read this very quickly, go right to the >>>>> Suggestions at the end] >>>>> >>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>> I'm giving you the short story: >>>>> >>>>> The code snippet >>>>> >>>>> try { >>>>> CommPortIdentifier cpi= >>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>> if (cpi.isCurrentlyOwned()) { >>>>> System.out.println(" ** port in use by " + >>>>> cpi.getCurrentOwner()); >>>>> } >>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>> } catch (NoSuchPortException nspe) { >>>>> // this should never happen >>>>> System.out.println(" ** no such port"); >>>>> return; >>>>> } catch (PortInUseException piue) { >>>>> System.out.println(" ** port could not be opened"); >>>>> piue.printStackTrace(); >>>>> return; >>>>> } >>>>> >>>>> would return >>>>> >>>>> >>>>> ** port could not be opened >>>>> gnu.io.PortInUseException: Unknown Application >>>>> at >>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>> at PortWindow.openPort(PortWindow.java:98) >>>>> ... >>>>> >>>>> Well, not a very strong indication to what was actually going on. >>>>> In fact, the problem was that the directory /var/lock did not exist. >>>>> >>>>> Some findings: >>>>> ---- >>>>> >>>>> - /var/lock does not exist by default on OS X >>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>> not contain a script which creates /var/lock (I did not use the >>>>> installer but I dissected it with Pacifist) >>>>> - the INSTALL file in the bins package talks about a file >>>>> fixperm.sh which is not included. no further information is >>>>> provided what this script does >>>>> - the file fixperm.sh is only in the src tarball and still checks >>>>> for /var/spool/uucp furthermore it wants to add the current user >>>>> to the group uucp. >>>>> - the default installation suggestion (for Mac and others) seems >>>>> like a rather intrusive choice. /Library/Java/Extensions is global >>>>> and hence might lead to version conflicts, however RXTX will work >>>>> just fine if RXTXcomm.jar is in the classpath (which is obvious to >>>>> any java programmer) and librxtxSerial.jnilib is in >>>>> java.library.path (which includes the current (launch) directory). >>>>> [RXTXcomm.jar might even try to locate librxtxSerial.jnilib and >>>>> load it with the Sytem.load(fullpath).] >>>>> >>>>> >>>>> Suggestions: >>>>> ---- >>>>> >>>>> - the implementation should check if it can write to the lock >>>>> directory and if not produce a meaningfull error message >>>>> containing the lock directory path (maybe with a distinction of >>>>> not existant / not writable) >>>>> - a description should be added to bin-tarball/INSTALL that the >>>>> /var/lock directory must exist and be writable on the Mac >>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>> regarding JNI loading (ie mentioning java.library.path and current >>>>> directory) >>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>> date and overly specific regarding the uucp group. in fact as >>>>> there is no default permission, /var/lock "could" be world >>>>> writable it is not up to RXTX to define this... >>>>> >>>>> >>>>> As a new user, I dont feel in a position to check in changes to >>>>> the CVS tree. Should I? >>>>> >>>>> Regards, >>>>> Joachim >>>>> >>>>> _______________________________________________ >>>>> Rxtx mailing list >>>>> Rxtx at qbang.org >>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> >>>> >>>> ------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> >>> >>> ------------------------------------------------------------------------ >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> ------------------------------------------------------------------------ >>> >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: 15.03.2006 > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu vernichten! This mail and any files transmitted with it is intended to be confidential and for the use of only the individual or entity named above. If the reader of this message is not the intended recipient, you are notified that retention, dissemination, distribution or copying of this mail and files transmitted with it is strictly prohibited. If you receive this mail in error, please notify us immediately by mail or phone and delete the mail and any files transmitted with it. Thank you! We also like to inform you that communication via mail over the internet is insecure, and third parties may have the possibility to access or manipulate the mail and any files transmitted with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/c61a8c46/attachment-0011.html From joachim at buechse.de Sat Mar 18 03:27:56 2006 From: joachim at buechse.de (Joachim Buechse) Date: Sat, 18 Mar 2006 11:27:56 +0100 Subject: [Rxtx] Re: Mac installer In-Reply-To: <12094005.1142621825757.JavaMail.dmarkman@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> Message-ID: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> > I think it's generally good idea to check latest available version > before starting to make conclusions My excuses, using Pacifist indeed misled me. Aparently the version I installed on my new Mac (which has been around some years) no longer shows the scripts. Infact, they are there. Why did I not this installer? The installer gives no indication what it will install and where but requests an administrator password - this is generally the kind of installer I dont run on my development system as cleaning up afterwards tends to be a lot of work (see Palm and HP installers). Be it as it is, firing up the latest (TIGER) installer brings up an Important Information screen which reads: IMPORTANT!!! BEFORE YOU START You should have folder uucp in directory /var/spool if you don't have it, create it with the command sudo mkdir /var/spool/uucp setup permission: sudo chmod 775 /var/spool/uucp You should be a member of the uucp group you can use the NetInfo utility or use the following commands sudo niutil -destroyval / /groups/uucp users `whoami` sudo niutil -appendprop / /groups/uucp users `whoami` you can found the script RXTX.pre_install in RXTX source-tree: rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install I wanted to update file Readme.rtf yesterday, but no direct checkin possibility to the repository prevented me from doing this. Regards, joachim On 17.03.2006, at 19:57, Dmitry Markman wrote: > I think it's generally good idea to check latest available version > before starting to make conclusions > > latest installer (it's at least few weeks old) has script for > creating /var/lock directory and it has universal binaries too > > however implementing different locking mechanism (via ioctl) as was > suggested on that list could be > good idea (it should be investigated) > > BTW: you don't need any 3rd party software to investigate installer > don't forget rxtx is open source software and everything is > available from the CVS > (tarball has latest stuff too) > it has apple's packagemaker project file > it has all scripts - everything you need > bottom line: don't hack :-) > just download it and enjoy > if you see the bug report it or fix it by yourself > > regards > > > On Friday, March 17, 2006, at 10:27AM, Joachim Buechse > wrote: > >> Good day, >> >> [If you want to read this very quickly, go right to the Suggestions >> at the end] >> >> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >> giving you the short story: >> >> The code snippet >> >> try { >> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >> (_selectedPort); >> if (cpi.isCurrentlyOwned()) { >> System.out.println(" ** port in use by " + cpi.getCurrentOwner >> ()); >> } >> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >> } catch (NoSuchPortException nspe) { >> // this should never happen >> System.out.println(" ** no such port"); >> return; >> } catch (PortInUseException piue) { >> System.out.println(" ** port could not be opened"); >> piue.printStackTrace(); >> return; >> } >> >> would return >> >> >> ** port could not be opened >> gnu.io.PortInUseException: Unknown Application >> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >> 354) >> at PortWindow.openPort(PortWindow.java:98) >> ... >> >> Well, not a very strong indication to what was actually going on. In >> fact, the problem was that the directory /var/lock did not exist. >> >> Some findings: >> ---- >> >> - /var/lock does not exist by default on OS X >> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >> contain a script which creates /var/lock (I did not use the installer >> but I dissected it with Pacifist) >> - the INSTALL file in the bins package talks about a file fixperm.sh >> which is not included. no further information is provided what this >> script does >> - the file fixperm.sh is only in the src tarball and still checks >> for /var/spool/uucp furthermore it wants to add the current user to >> the group uucp. >> - the default installation suggestion (for Mac and others) seems like >> a rather intrusive choice. /Library/Java/Extensions is global and >> hence might lead to version conflicts, however RXTX will work just >> fine if RXTXcomm.jar is in the classpath (which is obvious to any >> java programmer) and librxtxSerial.jnilib is in java.library.path >> (which includes the current (launch) directory). [RXTXcomm.jar might >> even try to locate librxtxSerial.jnilib and load it with the >> Sytem.load(fullpath).] >> >> >> Suggestions: >> ---- >> >> - the implementation should check if it can write to the lock >> directory and if not produce a meaningfull error message containing >> the lock directory path (maybe with a distinction of not existant / >> not writable) >> - a description should be added to bin-tarball/INSTALL that the /var/ >> lock directory must exist and be writable on the Mac >> - the file bin-tarball/INSTALL should be more descriptive regarding >> JNI loading (ie mentioning java.library.path and current directory) >> - the script contrib/fixperm.sh should be removed. it is out of date >> and overly specific regarding the uucp group. in fact as there is no >> default permission, /var/lock "could" be world writable it is not up >> to RXTX to define this... >> >> >> As a new user, I dont feel in a position to check in changes to the >> CVS tree. Should I? >> >> Regards, >> Joachim >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > > Dmitry Markman, PhD > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dmarkman at mac.com Sat Mar 18 04:46:55 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:46:55 -0500 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441BBB2D.8030305@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: RXTX_Tiger.pkg.sitx.hqx decode and decompress you'll have RXTX_Tiger.pkg also RXTX_Tiger.pmproj.sitx.hqx contains Apple's package maker project (RXTX_Tiger.pmproj) so you can make your own installer if you want On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > Dimitry, > > I look a little bit around in MACOSX_IDE. I did not found any OSX > installer. Which is the filename. > > A Installer for Linux and Windows is no prop. > > Hans > > Dmitry Markman schrieb: >> we certainly have such an installer for mac os x >> I have no idea about linux (linux people probably don't need any >> installer though) >> it would be nice to have windows installer I think >> >> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >> >>> Dimitry, >>> >>> thanks for Your answer. >>> >>> First, I need a external installer for the 4 major platforms. If >>> it's possible, than as jnlp. >>> My dream is ONE jnlp installer for all the platforms. >>> >>> But for the first time it would be helpfully, if i had one >>> external installer for each platform (with a link on it). >>> >>> Hans >>> >>> PS: Could it be possible, to put all installer out of the >>> development package into a separate dictionary? It could not be >>> the intention, that every non developer user (-> simple user) >>> must download the development package and find and extract the >>> right installer for his platform. >>> >>> >>> >>> Dmitry Markman schrieb: >>>> Hans if you want to use rxtx from jnlp, then it's different >>>> story 1. you can put installer into the jar file (you can find >>>> installer in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) >>>> put some flag (or use othe mechanism) to check is rxtx installed >>>> b) if not extract installer from your jar file and run it via >>>> System.exec 2. you can put jar file and jnilib file into your >>>> jar file and do exactly what I say yearlier but in addition you >>>> have to run the script. that script requires system privileges >>>> I'm not sure how to do that from java I'll try to play with that >>>> today at home if I'll be successful I'll let you know On Friday, >>>> March 17, 2006, at 04:22PM, WILLICon wrote: >>>>> <>_______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>> Dmitry Markman, PhD >>>> >>>> Dimitry, >>>> >>>> where can I find the installer. >>>> I'm not a OSX user, please describe it for a stupid windows user >>>> of RXTX :-) >>>> >>>> I've a dream of a jnlp application, what is doing all the jobs >>>> for the 4 major platforms. >>>> >>>> Hans >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> I'm just curious why installer I created for mac os x (latest >>>>> tarball contains it) isn't used (or mentioned) in that >>>>> installation tips it looks like it works fine if it's not I'd >>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>> 11:39AM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> @All >>>>> >>>>> I've the same problem of the "description of installation" of >>>>> my users (on several platforms). >>>>> >>>>> So I develop a short description of the RXTX installation >>>>> process - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>> >>>>> Sorry, it's till now in German, but I believe You understand >>>>> the structure. First I describe the general installation based >>>>> from the Java home dictionary. The second part describe the >>>>> installation based on the current (launch) directory. >>>>> >>>>> Link: http://www.chris-werx.de/Installation.html >>>>> >>>>> If I have from all platforms the confirm that it works, than I >>>>> put it into the Wiki. >>>>> >>>>> Hans >>>>> >>>>> >>>>> >>>>> Joachim Buechse schrieb: >>>>>> Good day, >>>>>> >>>>>> [If you want to read this very quickly, go right to the >>>>>> Suggestions at the end] >>>>>> >>>>>> I had some trouble getting RXTX to work on MacOS X Tiger >>>>>> 10.4.5. I'm giving you the short story: >>>>>> >>>>>> The code snippet >>>>>> >>>>>> try { >>>>>> CommPortIdentifier cpi= >>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>> if (cpi.isCurrentlyOwned()) { >>>>>> System.out.println(" ** port in use by " + >>>>>> cpi.getCurrentOwner()); >>>>>> } >>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>> } catch (NoSuchPortException nspe) { >>>>>> // this should never happen >>>>>> System.out.println(" ** no such port"); >>>>>> return; >>>>>> } catch (PortInUseException piue) { >>>>>> System.out.println(" ** port could not be opened"); >>>>>> piue.printStackTrace(); >>>>>> return; >>>>>> } >>>>>> >>>>>> would return >>>>>> >>>>>> >>>>>> ** port could not be opened >>>>>> gnu.io.PortInUseException: Unknown Application >>>>>> at gnu.io.CommPortIdentifier.open >>>>>> (CommPortIdentifier.java:354) >>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>> ... >>>>>> >>>>>> Well, not a very strong indication to what was actually going >>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>> not exist. >>>>>> >>>>>> Some findings: >>>>>> ---- >>>>>> >>>>>> - /var/lock does not exist by default on OS X >>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz >>>>>> does not contain a script which creates /var/lock (I did not >>>>>> use the installer but I dissected it with Pacifist) >>>>>> - the INSTALL file in the bins package talks about a file >>>>>> fixperm.sh which is not included. no further information is >>>>>> provided what this script does >>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>> current user to the group uucp. >>>>>> - the default installation suggestion (for Mac and others) >>>>>> seems like a rather intrusive choice. /Library/Java/Extensions >>>>>> is global and hence might lead to version conflicts, however >>>>>> RXTX will work just fine if RXTXcomm.jar is in the classpath >>>>>> (which is obvious to any java programmer) and >>>>>> librxtxSerial.jnilib is in java.library.path (which includes >>>>>> the current (launch) directory). [RXTXcomm.jar might even try >>>>>> to locate librxtxSerial.jnilib and load it with the Sytem.load >>>>>> (fullpath).] >>>>>> >>>>>> >>>>>> Suggestions: >>>>>> ---- >>>>>> >>>>>> - the implementation should check if it can write to the lock >>>>>> directory and if not produce a meaningfull error message >>>>>> containing the lock directory path (maybe with a distinction >>>>>> of not existant / not writable) >>>>>> - a description should be added to bin-tarball/INSTALL that >>>>>> the /var/lock directory must exist and be writable on the Mac >>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>> current directory) >>>>>> - the script contrib/fixperm.sh should be removed. it is out >>>>>> of date and overly specific regarding the uucp group. in fact >>>>>> as there is no default permission, /var/lock "could" be world >>>>>> writable it is not up to RXTX to define this... >>>>>> >>>>>> >>>>>> As a new user, I dont feel in a position to check in changes >>>>>> to the CVS tree. Should I? >>>>>> >>>>>> Regards, >>>>>> Joachim >>>>>> >>>>>> _______________________________________________ >>>>>> Rxtx mailing list >>>>>> Rxtx at qbang.org >>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ Rxtx mailing >>>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ Rxtx mailing >>>> list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> Dmitry Markman >> >> _______________________________________________ Rxtx mailing list >> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo >> virus found in this incoming message. Checked by AVG Free Edition. >> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >> 15.03.2006 > > -- Mit freundlichen Gr??en Hans-Joachim Willi WilliCON - Medien- > und Technikberatung Goldregenweg 15 70794 Filderstadt Fon: > +49-711-4080181 Fax: +49-711-7777050 mail at willicon.de Diese E-Mail > und etwa anliegende Dateien sind nur f?r den bezeichneten Empf?nger > bestimmt. Sie enth?lt vertrauliche Korrespondenz. Sofern Sie als > Dritter diese Mail erhalten, senden Sie diese bitte ungelesen an > den Absender zur?ck, informieren Sie uns und l?schen Sie diese Mail > sofort inkl. der Anlagen. Eventuelle Ausdrucke sind sofort zu > vernichten! This mail and any files transmitted with it is intended > to be confidential and for the use of only the individual or entity > named above. If the reader of this message is not the intended > recipient, you are notified that retention, dissemination, > distribution or copying of this mail and files transmitted with it > is strictly prohibited. If you receive this mail in error, please > notify us immediately by mail or phone and delete the mail and any > files transmitted with it. Thank you! We also like to inform you > that communication via mail over the internet is insecure, and > third parties may have the possibility to access or manipulate the > mail and any files transmitted with it. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From zamek at vili.pmmf.hu Sat Mar 18 04:50:12 2006 From: zamek at vili.pmmf.hu (Zidarics Zoltan) Date: Sat, 18 Mar 2006 12:50:12 +0100 Subject: [Rxtx] rs-485 Message-ID: <200603181250.12623.zamek@vili.pmmf.hu> Hello, I am new in rxtx :) I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface by Jamod ( http://sourceforge.net/project/jamod ). There is a plc with an usb-serial converter, it works very well. And now I have to communicate another device which has an rs485 modbus interface. I use an external rs-232/rs485 hardware converter. It has independent in and out connectors for rs 485, and it can be setting handshake by rts/cts. I set it with serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); When I see it with an oscilloscope, I cannot see rts change on it , but A and B of rs485 works well. :( How can I force rts/cts handshake or did I make a mistake? Is it helps, if I set somewhere an rs485 interface? Jamod open port by an m_SerialPort = (SerialPort) m_PortIdentifyer.open("Modbus Serial Master", 30000); it is a single rs232 port. Can I set rs485 anywhere, forexample in javax.comm.properties? thx a lot... -- Zoltan Zidarics programmer PTE University Pecs, Hungary icq: 43288694 From dmarkman at mac.com Sat Mar 18 04:57:34 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Sat, 18 Mar 2006 06:57:34 -0500 Subject: [Rxtx] Re: Mac installer In-Reply-To: <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <12094005.1142621825757.JavaMail.dmarkman@mac.com> <55843AFD-02AD-42A1-9929-041DFC48141C@buechse.de> Message-ID: <3D829DDA-2F58-429C-890F-91E1545EB536@mac.com> Joachim if you have new Readme version please send it to me and I'll commit it thank you very much in advance also new Apple's packager requires the name for preinstaller and preupgrader script just as preinstall and preupgrade and those 2 files you can find in CVS and in the latest tarball rxtx-2.1-7r2.zip your precautions about installer are justified for untrusted sources but rxrx installer is completely open and it puts its files only in 1 (well known) place (/Library/Java/ Extensions) also it creates /var/lock folder it works on my computer for years without any problem thanks On Mar 18, 2006, at 5:27 AM, Joachim Buechse wrote: >> I think it's generally good idea to check latest available version >> before starting to make conclusions > > My excuses, using Pacifist indeed misled me. Aparently the version > I installed on my new Mac (which has been around some years) no > longer shows the scripts. Infact, they are there. Why did I not > this installer? The installer gives no indication what it will > install and where but requests an administrator password - this is > generally the kind of installer I dont run on my development system > as cleaning up afterwards tends to be a lot of work (see Palm and > HP installers). > > > Be it as it is, firing up the latest (TIGER) installer brings up > an Important Information screen which reads: > > IMPORTANT!!! BEFORE YOU START > You should have folder uucp in directory /var/spool > if you don't have it, create it with the command > sudo mkdir /var/spool/uucp > setup permission: > sudo chmod 775 /var/spool/uucp > You should be a member of the uucp group > you can use the NetInfo utility or use the following > commands > sudo niutil -destroyval / /groups/uucp users `whoami` > sudo niutil -appendprop / /groups/uucp users `whoami` > > you can found the script RXTX.pre_install in RXTX source-tree: > rxtx-devel/MACOSX_IDE/ForPackageMaker/Resources/RXTX.pre_install > > > I wanted to update file Readme.rtf yesterday, but no direct checkin > possibility to the repository prevented me from doing this. > > Regards, > joachim > > > > > > On 17.03.2006, at 19:57, Dmitry Markman wrote: > >> I think it's generally good idea to check latest available version >> before starting to make conclusions >> >> latest installer (it's at least few weeks old) has script for >> creating /var/lock directory and it has universal binaries too >> >> however implementing different locking mechanism (via ioctl) as >> was suggested on that list could be >> good idea (it should be investigated) >> >> BTW: you don't need any 3rd party software to investigate installer >> don't forget rxtx is open source software and everything is >> available from the CVS >> (tarball has latest stuff too) >> it has apple's packagemaker project file >> it has all scripts - everything you need >> bottom line: don't hack :-) >> just download it and enjoy >> if you see the bug report it or fix it by yourself >> >> regards >> >> >> On Friday, March 17, 2006, at 10:27AM, Joachim Buechse >> wrote: >> >>> Good day, >>> >>> [If you want to read this very quickly, go right to the Suggestions >>> at the end] >>> >>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. I'm >>> giving you the short story: >>> >>> The code snippet >>> >>> try { >>> CommPortIdentifier cpi= CommPortIdentifier.getPortIdentifier >>> (_selectedPort); >>> if (cpi.isCurrentlyOwned()) { >>> System.out.println(" ** port in use by " + cpi.getCurrentOwner >>> ()); >>> } >>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>> } catch (NoSuchPortException nspe) { >>> // this should never happen >>> System.out.println(" ** no such port"); >>> return; >>> } catch (PortInUseException piue) { >>> System.out.println(" ** port could not be opened"); >>> piue.printStackTrace(); >>> return; >>> } >>> >>> would return >>> >>> >>> ** port could not be opened >>> gnu.io.PortInUseException: Unknown Application >>> at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java: >>> 354) >>> at PortWindow.openPort(PortWindow.java:98) >>> ... >>> >>> Well, not a very strong indication to what was actually going on. In >>> fact, the problem was that the directory /var/lock did not exist. >>> >>> Some findings: >>> ---- >>> >>> - /var/lock does not exist by default on OS X >>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does not >>> contain a script which creates /var/lock (I did not use the >>> installer >>> but I dissected it with Pacifist) >>> - the INSTALL file in the bins package talks about a file fixperm.sh >>> which is not included. no further information is provided what this >>> script does >>> - the file fixperm.sh is only in the src tarball and still checks >>> for /var/spool/uucp furthermore it wants to add the current user to >>> the group uucp. >>> - the default installation suggestion (for Mac and others) seems >>> like >>> a rather intrusive choice. /Library/Java/Extensions is global and >>> hence might lead to version conflicts, however RXTX will work just >>> fine if RXTXcomm.jar is in the classpath (which is obvious to any >>> java programmer) and librxtxSerial.jnilib is in java.library.path >>> (which includes the current (launch) directory). [RXTXcomm.jar might >>> even try to locate librxtxSerial.jnilib and load it with the >>> Sytem.load(fullpath).] >>> >>> >>> Suggestions: >>> ---- >>> >>> - the implementation should check if it can write to the lock >>> directory and if not produce a meaningfull error message containing >>> the lock directory path (maybe with a distinction of not existant / >>> not writable) >>> - a description should be added to bin-tarball/INSTALL that the / >>> var/ >>> lock directory must exist and be writable on the Mac >>> - the file bin-tarball/INSTALL should be more descriptive regarding >>> JNI loading (ie mentioning java.library.path and current directory) >>> - the script contrib/fixperm.sh should be removed. it is out of date >>> and overly specific regarding the uucp group. in fact as there is no >>> default permission, /var/lock "could" be world writable it is not up >>> to RXTX to define this... >>> >>> >>> As a new user, I dont feel in a position to check in changes to the >>> CVS tree. Should I? >>> >>> Regards, >>> Joachim >>> >>> _______________________________________________ >>> Rxtx mailing list >>> Rxtx at qbang.org >>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> >> >> >> Dmitry Markman, PhD >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Sat Mar 18 10:07:52 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 10:07:52 -0700 (MST) Subject: [Rxtx] rs-485 In-Reply-To: <200603181250.12623.zamek@vili.pmmf.hu> References: <200603181250.12623.zamek@vili.pmmf.hu> Message-ID: On Sat, 18 Mar 2006, Zidarics Zoltan wrote: > Hello, > > I am new in rxtx :) > I use Debian Linux testing (kernel 2.6.15) and java 1.5. and Modbus interface > by Jamod ( http://sourceforge.net/project/jamod ). > > There is a plc with an usb-serial converter, it works very well. > And now I have to communicate another device which has an rs485 modbus > interface. I use an external rs-232/rs485 hardware converter. It has > independent in and out connectors for rs 485, and it can be setting handshake > by rts/cts. I set it with > serialParameter.setFlowControlOut(SerialPort.FLOWCONTROL_RTSCTS_OUT); > When I see it with an oscilloscope, I cannot see rts change on it , but A and > B of rs485 works well. :( > > How can I force rts/cts handshake or did I make a mistake? > > Is it helps, if I set somewhere an rs485 interface? > > Jamod open port by an > m_SerialPort = (SerialPort) > m_PortIdentifyer.open("Modbus Serial Master", 30000); > > it is a single rs232 port. Can I set rs485 anywhere, > forexample in javax.comm.properties? > Hi Zidarics I think the rxtx code for rts/cts is OK. You can look at SerialImp.c to see for yourself.. JNIEXPORT void JNICALL RXTXPort(setflowcontrol)( JNIEnv *env, jobject jobj, jint flowmode ) { struct termios ttyset; int fd = get_java_var( env, jobj,"fd","I" ); ENTER( "RXTXPort:setflowcontrol" ); if( tcgetattr( fd, &ttyset ) ) goto fail; if ( flowmode & ( FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT ) ) { ttyset.c_cflag |= HARDWARE_FLOW_CONTROL; } else ttyset.c_cflag &= ~HARDWARE_FLOW_CONTROL; ... It may be the kernel driver for your usb/serial that is the problem. Have you tried just a normal serial port to confirm? -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 10:16:56 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 18:16:56 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> Message-ID: <441C4088.5090905@willicon.de> thx Dmitry Markman schrieb: > RXTX_Tiger.pkg.sitx.hqx > > decode and decompress > you'll have RXTX_Tiger.pkg > > also > RXTX_Tiger.pmproj.sitx.hqx > > contains Apple's package maker project (RXTX_Tiger.pmproj) > so you can make your own installer if you want > > > > > > On Mar 18, 2006, at 2:47 AM, WILLICon wrote: > >> Dimitry, >> >> I look a little bit around in MACOSX_IDE. I did not found any OSX >> installer. Which is the filename. >> >> A Installer for Linux and Windows is no prop. >> >> Hans >> >> Dmitry Markman schrieb: >>> we certainly have such an installer for mac os x >>> I have no idea about linux (linux people probably don't need any >>> installer though) >>> it would be nice to have windows installer I think >>> >>> On Mar 17, 2006, at 6:08 PM, WILLICon wrote: >>> >>>> Dimitry, >>>> >>>> thanks for Your answer. >>>> >>>> First, I need a external installer for the 4 major platforms. If >>>> it's possible, than as jnlp. >>>> My dream is ONE jnlp installer for all the platforms. >>>> >>>> But for the first time it would be helpfully, if i had one external >>>> installer for each platform (with a link on it). >>>> >>>> Hans >>>> >>>> PS: Could it be possible, to put all installer out of the >>>> development package into a separate dictionary? It could not be the >>>> intention, that every non developer user (-> simple user) must >>>> download the development package and find and extract the right >>>> installer for his platform. >>>> >>>> >>>> >>>> Dmitry Markman schrieb: >>>>> Hans if you want to use rxtx from jnlp, then it's different story >>>>> 1. you can put installer into the jar file (you can find installer >>>>> in rxtx-devel/MACOSX_IDE/ForPackageMaker folder) a) put some flag >>>>> (or use othe mechanism) to check is rxtx installed b) if not >>>>> extract installer from your jar file and run it via System.exec 2. >>>>> you can put jar file and jnilib file into your jar file and do >>>>> exactly what I say yearlier but in addition you have to run the >>>>> script. that script requires system privileges I'm not sure how to >>>>> do that from java I'll try to play with that today at home if I'll >>>>> be successful I'll let you know On Friday, March 17, 2006, at >>>>> 04:22PM, WILLICon wrote: >>>>>> <>_______________________________________________ Rxtx mailing >>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>> Dmitry Markman, PhD >>>>> >>>>> Dimitry, >>>>> >>>>> where can I find the installer. >>>>> I'm not a OSX user, please describe it for a stupid windows user >>>>> of RXTX :-) >>>>> >>>>> I've a dream of a jnlp application, what is doing all the jobs for >>>>> the 4 major platforms. >>>>> >>>>> Hans >>>>> >>>>> >>>>> Dmitry Markman schrieb: >>>>>> I'm just curious why installer I created for mac os x (latest >>>>>> tarball contains it) isn't used (or mentioned) in that >>>>>> installation tips it looks like it works fine if it's not I'd >>>>>> like to see reproducable case On Friday, March 17, 2006, at >>>>>> 11:39AM, WILLICon wrote: >>>>>>> <>_______________________________________________ Rxtx mailing >>>>>>> list Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtx >>>>>> Dmitry Markman, PhD >>>>>> >>>>>> @All >>>>>> >>>>>> I've the same problem of the "description of installation" of my >>>>>> users (on several platforms). >>>>>> >>>>>> So I develop a short description of the RXTX installation process >>>>>> - of the 4 main platforms (Win, OSX, Linux and Solaris). >>>>>> >>>>>> Sorry, it's till now in German, but I believe You understand the >>>>>> structure. First I describe the general installation based from >>>>>> the Java home dictionary. The second part describe the >>>>>> installation based on the current (launch) directory. >>>>>> >>>>>> Link: http://www.chris-werx.de/Installation.html >>>>>> >>>>>> If I have from all platforms the confirm that it works, than I >>>>>> put it into the Wiki. >>>>>> >>>>>> Hans >>>>>> >>>>>> >>>>>> >>>>>> Joachim Buechse schrieb: >>>>>>> Good day, >>>>>>> >>>>>>> [If you want to read this very quickly, go right to the >>>>>>> Suggestions at the end] >>>>>>> >>>>>>> I had some trouble getting RXTX to work on MacOS X Tiger 10.4.5. >>>>>>> I'm giving you the short story: >>>>>>> >>>>>>> The code snippet >>>>>>> >>>>>>> try { >>>>>>> CommPortIdentifier cpi= >>>>>>> CommPortIdentifier.getPortIdentifier(_selectedPort); >>>>>>> if (cpi.isCurrentlyOwned()) { >>>>>>> System.out.println(" ** port in use by " + >>>>>>> cpi.getCurrentOwner()); >>>>>>> } >>>>>>> _currentPort= cpi.open(APP_BEAMICON, OPEN_TIMEOUT); >>>>>>> } catch (NoSuchPortException nspe) { >>>>>>> // this should never happen >>>>>>> System.out.println(" ** no such port"); >>>>>>> return; >>>>>>> } catch (PortInUseException piue) { >>>>>>> System.out.println(" ** port could not be opened"); >>>>>>> piue.printStackTrace(); >>>>>>> return; >>>>>>> } >>>>>>> >>>>>>> would return >>>>>>> >>>>>>> >>>>>>> ** port could not be opened >>>>>>> gnu.io.PortInUseException: Unknown Application >>>>>>> at >>>>>>> gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) >>>>>>> at PortWindow.openPort(PortWindow.java:98) >>>>>>> ... >>>>>>> >>>>>>> Well, not a very strong indication to what was actually going >>>>>>> on. In fact, the problem was that the directory /var/lock did >>>>>>> not exist. >>>>>>> >>>>>>> Some findings: >>>>>>> ---- >>>>>>> >>>>>>> - /var/lock does not exist by default on OS X >>>>>>> - the RXTX_Tiger.sitx.hqx installer in rxtx-2.1-7r2.tar.gz does >>>>>>> not contain a script which creates /var/lock (I did not use the >>>>>>> installer but I dissected it with Pacifist) >>>>>>> - the INSTALL file in the bins package talks about a file >>>>>>> fixperm.sh which is not included. no further information is >>>>>>> provided what this script does >>>>>>> - the file fixperm.sh is only in the src tarball and still >>>>>>> checks for /var/spool/uucp furthermore it wants to add the >>>>>>> current user to the group uucp. >>>>>>> - the default installation suggestion (for Mac and others) seems >>>>>>> like a rather intrusive choice. /Library/Java/Extensions is >>>>>>> global and hence might lead to version conflicts, however RXTX >>>>>>> will work just fine if RXTXcomm.jar is in the classpath (which >>>>>>> is obvious to any java programmer) and librxtxSerial.jnilib is >>>>>>> in java.library.path (which includes the current (launch) >>>>>>> directory). [RXTXcomm.jar might even try to locate >>>>>>> librxtxSerial.jnilib and load it with the Sytem.load(fullpath).] >>>>>>> >>>>>>> >>>>>>> Suggestions: >>>>>>> ---- >>>>>>> >>>>>>> - the implementation should check if it can write to the lock >>>>>>> directory and if not produce a meaningfull error message >>>>>>> containing the lock directory path (maybe with a distinction of >>>>>>> not existant / not writable) >>>>>>> - a description should be added to bin-tarball/INSTALL that the >>>>>>> /var/lock directory must exist and be writable on the Mac >>>>>>> - the file bin-tarball/INSTALL should be more descriptive >>>>>>> regarding JNI loading (ie mentioning java.library.path and >>>>>>> current directory) >>>>>>> - the script contrib/fixperm.sh should be removed. it is out of >>>>>>> date and overly specific regarding the uucp group. in fact as >>>>>>> there is no default permission, /var/lock "could" be world >>>>>>> writable it is not up to RXTX to define this... >>>>>>> >>>>>>> >>>>>>> As a new user, I dont feel in a position to check in changes to >>>>>>> the CVS tree. Should I? >>>>>>> >>>>>>> Regards, >>>>>>> Joachim >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Rxtx mailing list >>>>>>> Rxtx at qbang.org >>>>>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>>>>>> >>>>>>> >>>>>> >>>>>> _______________________________________________ Rxtx mailing list >>>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>>> >>>>> _______________________________________________ Rxtx mailing list >>>>> Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx >>>> >>>> _______________________________________________ >>>> Rxtx mailing list >>>> Rxtx at qbang.org >>>> http://mailman.qbang.org/mailman/listinfo/rxtx >>> >>> Dmitry Markman >>> >>> _______________________________________________ Rxtx mailing list >>> Rxtx at qbang.orghttp://mailman.qbang.org/mailman/listinfo/rxtxNo virus >>> found in this incoming message. Checked by AVG Free Edition. >>> Version: 7.1.385 / Virus Database: 268.2.4/282 - Release Date: >>> 15.03.2006 >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > Dmitry Markman > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/8fbe4822/attachment-0011.html From tjarvi at qbang.org Sat Mar 18 11:46:34 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 11:46:34 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C4088.5090905@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: Looking at the email headers it appears that thunderbird is your email client? It really does this? Dmitry Markman schrieb: Hans if you want to use rxtx from jnlp, then it's different -- Trent Jarvi tjarvi at qbang.org From mail at willicon.de Sat Mar 18 12:03:40 2006 From: mail at willicon.de (WILLICon) Date: Sat, 18 Mar 2006 20:03:40 +0100 Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <441C598C.5040403@willicon.de> Trent, question to whom? Yes, I've a thunderbird. Is that a prop? I see everything ok. Should I change something? Hans Trent Jarvi schrieb: > > > Looking at the email headers it appears that thunderbird is your email > client? It really does this? > > Dmitry Markman > schrieb: > Hans > if > you > want > to > use > rxtx > from > jnlp, > then > it's > different > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From tjarvi at qbang.org Sat Mar 18 12:08:33 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 12:08:33 -0700 (MST) Subject: [Rxtx] RFC: Lock files for dummies (Mac OS X and others) In-Reply-To: <441C598C.5040403@willicon.de> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <441C598C.5040403@willicon.de> Message-ID: It must be my old pine email client. The web version looks fine. http://mailman.qbang.org/pipermail/rxtx/Week-of-Mon-20060313/002180.html On Sat, 18 Mar 2006, WILLICon wrote: > Trent, > > question to whom? > > Yes, I've a thunderbird. Is that a prop? > I see everything ok. Should I change something? > > Hans > > > Trent Jarvi schrieb: >> >> >> Looking at the email headers it appears that thunderbird is your email >> client? It really does this? >> >> Dmitry Markman >> schrieb: >> Hans >> if >> you >> want >> to >> use >> rxtx >> from >> jnlp, >> then >> it's >> different >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx >> >> > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Sat Mar 18 13:32:28 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 18 Mar 2006 13:32:28 -0700 (MST) Subject: [Rxtx] Re: 14400 Baud for w32 don't work - news (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 18 Mar 2006 23:28:41 +0300 From: Peter Neo To: Trent Jarvi Subject: Re: 14400 Baud for w32 don't work - news Hi, Excuse me, but I don't know how it work now:) Your rxrxSerial.dll, dont work. But... I did apply your patch on sources downloaded before (2.1-7r2) and did compile with MS VS toolkit 2003 (free on MS) + MinGW includes. And this is working, i.e. baundrate sets to 14400. I'm in process, so I'll try it with a real scales on Monday. > Was this just opening the port? Did you try setting a baud rate? yes, sure. So, thank you much. Peter. PS: I send you my makefile and build script from /build dir. These files contains my paths and system variables. -------------- next part -------------- #ifdef TRENT_IS_HERE #define TRACE #define DEBUG #define DEBUG_MW #ifdef DEBUG_MW extern void mexWarMsgTxt( const char * ); extern void mexPrintf( const char *, ... ); #endif /* DEBUG_MW */ #endif /* TRENT_IS_HERE */ extern void report( char * ); extern void report_warning( char * ); extern void report_error( char * ); /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2006 by Trent Jarvi taj at www.linux.org.uk. | Copyright 1998-2002 by Wayne roberts wroberts1 at home.com | | 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. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | 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 --------------------------------------------------------------------------*/ #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; extern int errno; struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ void set_errno( int error ) { my_errno = error; } /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ void usleep( unsigned long usec ) { Sleep( usec/1000 ); } /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: set_errno(EINVAL ); return -1; } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B256000: ret = CBR_256000; break; case B230400: ret = CBR_230400; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: fprintf( stderr, "B_to_CBR: invalid baudrate: %#o\n", Baud ); set_errno( EINVAL ); return -1; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } // [PN] 18.03.06 //dcb->BaudRate = CBR_9600 ; dcb->BaudRate = CBR_14400; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); // [PN] 18.03.06 //cfsetospeed( ttyset, B9600 ); cfsetospeed( ttyset, CBR_14400 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strcpy(port->filename, filename ); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; ENTER( "serial_open" ); if ( port_opened( filename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( filename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", filename ); report( message ); serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilites!" ); serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int serial_write( int fd, char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { int ret; vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ret = ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ret = ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); sprintf( message, "===== cfsetospeed: speed: %#o\n", speed ); report( message ); speed = B14400; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); return 0; } s_termios->c_ispeed = s_termios->c_ospeed = speed; /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); // [PN] 18.03.06 //s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ispeed = CBR_14400; //CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void show_DCB( myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; // [PN] 18.03.06 dcb.BaudRate = CBR_14400; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ ENTER( "tcflush" ); if ( !index ) { LEAVE( "tcflush" ); return -1; } index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ int fstat( int fd, ... ) { return( 0 ); } /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, result, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; struct async_struct *astruct; struct serial_multiport_struct *mstruct; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); /* TIOCMIS, TIOCMBIC and TIOCMSET all do the same thing... */ case TIOCMBIS: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMBIC: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; result &= SETRTS; } else { index->MSR &= ~TIOCM_RTS; result &= CLRRTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: astruct = va_arg( ap, struct async_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERGETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSERSETMULTI: mstruct = va_arg( ap, struct serial_multiport_struct * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); if (ret == 0) goto fail; while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); } /*----------------------- END OF LIBRARY -----------------*/ #ifdef PLAYING_AROUND static inline int inportb( int index ) { unsigned char value; __asm__ volatile ( "inb %1,%0" : "=a" (value) : "d" ((unsigned short)index) ); return value; } static inline void outportb(unsigned char val, unsigned short int index) { __asm__ volatile ( "outb %0,%1\n" : : "a" (val), "d" (index) ); } #endif /* PLAYING_AROUND */ -------------- next part -------------- A non-text attachment was scrubbed... Name: build-install.cmd Type: application/octet-stream Size: 295 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/build-install-0011.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 3409 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060318/e52e3362/Makefile-0011.obj From dmarkman at mac.com Mon Mar 20 00:20:43 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 02:20:43 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> Message-ID: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Hi all I put RXTX installer that will install everything (and will create / var/lock if necessary and add user to the uucp group) for mac os x from Java into the rxtx's CVS repository it could be easily modified to install files for any platform it uses Greg Guerin's AuthKit for authentication and authorization Greg released that kit under artistic license, so Trent, please take a look we, probably, can negotiate license with Greg if it's necessary Greg's AuthKit could be downloaded from http://www.amug.org/~glguerin/ sw/#authkit Michael Hall (mikehall at spacestar dot net) had a suggestion to make implementation of the jaas LoginModule based on Greg's AuthKit (his modification of the Greg's AuthKit could be found at http:// www.spacestar.net/users/mikehall/authkit.dmg) but Michael's AuthKitLoginModule does only half a job: it does authenticate but it can not run any external unix process in privileged mode (at least I wasn't able to do so) possible explanation could be found in conversation between Greg and Michael at Apple's java-dev list (look for archives) so I didn't use jaas API for rxtxinstaller I created folder MacOSX in the contrib folder comment 1. if you want to run that installer as standalone application all you need that RXTXInstaller.jar 2. if you want to use webstart you have to add Greg's libAuthKit.jnilib to the mac os x's resources in theory RXTXInstaller.jar doesn't need it, but there is a problem with loading libAuthKit.jnilib from webstart authkit uses loadLibrary method to load library and it failed (from webstart) for standalone application I extract libAuthKit.jnilib from the RXTXInstaller.jar and put it into the /Library/Java/Extensions or ~/Library/Java/Extensions folder that file will be deleted after installer quit unfortunately I didn't have time to put documentation there but it is mostly self-explanatory I took installer code from my gl4java installer that I did about 3 years ago (with small modifications) it would be very nice if Apple will release LoginModule that really will do the job (com.apple.security.auth.module package????? ) (UnixLoginModule is pretty useless) From lyon at docjava.com Mon Mar 20 06:34:39 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 08:34:39 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Dimitry, This sounds like great work. Just a couple of questions; After the check out of the CVS files, using: setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot 53 8:28 setenv PASSWORD mousy 54 8:29 cvs login 55 8:29 cvs checkout rxtx-devel I cd'd over to: rxtx-devel/MACOSX_IDE And found: CVS/ CW/ ForPackageMaker/ PB/ Where is the installer? Thanks! - Doug From tjarvi at qbang.org Mon Mar 20 06:39:37 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 06:39:37 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Dimitry, > This sounds like great work. Just a couple of questions; > After the check out of the CVS files, using: > setenv CVSROOT > :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot > 53 8:28 setenv PASSWORD mousy > 54 8:29 cvs login > 55 8:29 cvs checkout rxtx-devel Hi Doug You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 The default branch is rxtx 2.0 which isn't very active right now. -- Trent Jarvi tjarvi at qbang.org From lyon at docjava.com Mon Mar 20 07:05:44 2006 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Mon, 20 Mar 2006 09:05:44 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: Hi Trent, Thanks for the info on the CVS checkout procedure. I did that and am still not sure where the installer is. Here is what I have: cd MACOSX_IDE/ p4.docjava.com{lyon}121: ls CVS/ ForPackageMaker/ PB/ p4.docjava.com{lyon}122: find . | more . ./ForPackageMaker ./ForPackageMaker/RXTX.pkg.sit.hqx ./ForPackageMaker/Resources ./ForPackageMaker/Resources/ReadMe.rtf ./ForPackageMaker/Resources/Welcome.rtf ./ForPackageMaker/Resources/CVS ./ForPackageMaker/Resources/CVS/Entries ./ForPackageMaker/Resources/CVS/Repository ./ForPackageMaker/Resources/CVS/Tag ./ForPackageMaker/Resources/CVS/Root ./ForPackageMaker/Resources/preinstall ./ForPackageMaker/Resources/License.rtf ./ForPackageMaker/Resources/preupgrade ./ForPackageMaker/RXTX.pmsp ./ForPackageMaker/CVS ./ForPackageMaker/CVS/Entries ./ForPackageMaker/CVS/Repository ./ForPackageMaker/CVS/Entries.Log ./ForPackageMaker/CVS/Tag ./ForPackageMaker/CVS/Root ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx ./ForPackageMaker/Install ./ForPackageMaker/Install/CVS ./ForPackageMaker/Install/CVS/Entries ./ForPackageMaker/Install/CVS/Repository ./ForPackageMaker/Install/CVS/Tag ./ForPackageMaker/Install/CVS/Root ./ForPackageMaker/Install/Library ./ForPackageMaker/Install/Library/CVS ./ForPackageMaker/Install/Library/CVS/Entries ./ForPackageMaker/Install/Library/CVS/Repository ./ForPackageMaker/Install/Library/CVS/Tag ./ForPackageMaker/Install/Library/CVS/Root ./ForPackageMaker/Install/Library/Java ./ForPackageMaker/Install/Library/Java/Extensions ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./ForPackageMaker/Install/Library/Java/Extensions/CVS ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./ForPackageMaker/Install/Library/Java/CVS ./ForPackageMaker/Install/Library/Java/CVS/Entries ./ForPackageMaker/Install/Library/Java/CVS/Repository ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log ./ForPackageMaker/Install/Library/Java/CVS/Tag ./ForPackageMaker/Install/Library/Java/CVS/Root ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx ./CVS ./CVS/Entries ./CVS/Repository ./CVS/Entries.Log ./CVS/Tag ./CVS/Root ./PB ./PB/LibSerialUniversal.xcodeproj.sitx.hqx ./PB/CVS ./PB/CVS/Entries ./PB/CVS/Repository ./PB/CVS/Entries.Log ./PB/CVS/Tag ./PB/CVS/Root ./PB/LibSerial.pbproj.sit.hqx ./PB/startpoint.c ./PB/config.h What is the procedure to run this installer? Do we need a README in: /rxtx-devel/MACOSX_IDE Here is what we have: CVS/ ForPackageMaker/ PB/ Thanks! - DL >On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >>Hi Dimitry, >>This sounds like great work. Just a couple of questions; >>After the check out of the CVS files, using: >>setenv CVSROOT >>:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot >> 53 8:28 setenv PASSWORD mousy >> 54 8:29 cvs login >> 55 8:29 cvs checkout rxtx-devel > >Hi Doug > >You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >The default branch is rxtx 2.0 which isn't very active right now. > >-- >Trent Jarvi >tjarvi at qbang.org From tjarvi at qbang.org Mon Mar 20 07:25:30 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:25:30 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. Hi Doug It does look like it was not cvs committed. There is no rxtx-devel/contrib/MacOSX directory in there at the moment. It was mentioned that it was put under contrib. -- Trent Jarvi tjarvi at qbang.org From dmarkman at mac.com Mon Mar 20 07:29:56 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:29:56 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <6054EB4E-F7E0-4A9C-BDDA-D582D6D8826F@mac.com> you can find it in the rxtx-devel/contrib folder On Mar 20, 2006, at 9:05 AM, Dr. Douglas Lyon wrote: > Hi Trent, > Thanks for the info on the CVS checkout procedure. > I did that and am still not sure where the installer is. > Here is what I have: > cd MACOSX_IDE/ > p4.docjava.com{lyon}121: ls > CVS/ ForPackageMaker/ PB/ > p4.docjava.com{lyon}122: find . | more > . > ./ForPackageMaker > ./ForPackageMaker/RXTX.pkg.sit.hqx > ./ForPackageMaker/Resources > ./ForPackageMaker/Resources/ReadMe.rtf > ./ForPackageMaker/Resources/Welcome.rtf > ./ForPackageMaker/Resources/CVS > ./ForPackageMaker/Resources/CVS/Entries > ./ForPackageMaker/Resources/CVS/Repository > ./ForPackageMaker/Resources/CVS/Tag > ./ForPackageMaker/Resources/CVS/Root > ./ForPackageMaker/Resources/preinstall > ./ForPackageMaker/Resources/License.rtf > ./ForPackageMaker/Resources/preupgrade > ./ForPackageMaker/RXTX.pmsp > ./ForPackageMaker/CVS > ./ForPackageMaker/CVS/Entries > ./ForPackageMaker/CVS/Repository > ./ForPackageMaker/CVS/Entries.Log > ./ForPackageMaker/CVS/Tag > ./ForPackageMaker/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pkg.sitx.hqx > ./ForPackageMaker/RXTX_Jag.pkg.sit.hqx > ./ForPackageMaker/Install > ./ForPackageMaker/Install/CVS > ./ForPackageMaker/Install/CVS/Entries > ./ForPackageMaker/Install/CVS/Repository > ./ForPackageMaker/Install/CVS/Tag > ./ForPackageMaker/Install/CVS/Root > ./ForPackageMaker/Install/Library > ./ForPackageMaker/Install/Library/CVS > ./ForPackageMaker/Install/Library/CVS/Entries > ./ForPackageMaker/Install/Library/CVS/Repository > ./ForPackageMaker/Install/Library/CVS/Tag > ./ForPackageMaker/Install/Library/CVS/Root > ./ForPackageMaker/Install/Library/Java > ./ForPackageMaker/Install/Library/Java/Extensions > ./ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar > ./ForPackageMaker/Install/Library/Java/Extensions/CVS > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Entries > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Repository > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Tag > ./ForPackageMaker/Install/Library/Java/Extensions/CVS/Root > ./ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib > ./ForPackageMaker/Install/Library/Java/CVS > ./ForPackageMaker/Install/Library/Java/CVS/Entries > ./ForPackageMaker/Install/Library/Java/CVS/Repository > ./ForPackageMaker/Install/Library/Java/CVS/Entries.Log > ./ForPackageMaker/Install/Library/Java/CVS/Tag > ./ForPackageMaker/Install/Library/Java/CVS/Root > ./ForPackageMaker/RXTX_Tiger.pmproj.sitx.hqx > ./CVS > ./CVS/Entries > ./CVS/Repository > ./CVS/Entries.Log > ./CVS/Tag > ./CVS/Root > ./PB > ./PB/LibSerialUniversal.xcodeproj.sitx.hqx > ./PB/CVS > ./PB/CVS/Entries > ./PB/CVS/Repository > ./PB/CVS/Entries.Log > ./PB/CVS/Tag > ./PB/CVS/Root > ./PB/LibSerial.pbproj.sit.hqx > ./PB/startpoint.c > ./PB/config.h > > What is the procedure to run this installer? > Do we need a README in: > /rxtx-devel/MACOSX_IDE > Here is what we have: > CVS/ ForPackageMaker/ PB/ > > > Thanks! > - DL > >> On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: >> >>> Hi Dimitry, >>> This sounds like great work. Just a couple of questions; >>> After the check out of the CVS files, using: >>> setenv CVSROOT :pserver:anonymous at cvs.milestonesolutions.com:/usr/ >>> local/cvsroot >>> 53 8:28 setenv PASSWORD mousy >>> 54 8:29 cvs login >>> 55 8:29 cvs checkout rxtx-devel >> >> Hi Doug >> >> You want "cvs checkout -r commapi-0-0-1 rxtx-devel" to get RXTX 2.1 >> The default branch is rxtx 2.0 which isn't very active right now. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From mikehall at spacestar.net Mon Mar 20 05:25:25 2006 From: mikehall at spacestar.net (Michael Hall) Date: Mon, 20 Mar 2006 06:25:25 -0600 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: > > Michael Hall (mikehall at spacestar dot net) had a suggestion to > make implementation of the jaas LoginModule > based on Greg's AuthKit > (his modification of the Greg's AuthKit could be found at http:// > www.spacestar.net/users/mikehall/authkit.dmg) > but Michael's AuthKitLoginModule does only half a job: > it does authenticate > but it can not run any external unix process in privileged mode (at > least I wasn't able to do so) If you got it working directly with Greg's the point is moot. But to clarify it anyhow. The login module does not allow you to do anything anything privileged on return as was explained by Greg. You need to work with a separate privileged process using the execPrivileged method of his API. I assume you did something similar although I haven't looked at how you are using it yet. I allowed instead for a action to be performed at the same time you login/authenticate,this... System.setProperty("authkit.action","/usr/bin/id"); just before this... lc.login(); To clarify, safely ignored as you are already complete. Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20060320/f6e18202/smime-0011.bin From dmarkman at mac.com Mon Mar 20 07:36:47 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:36:47 -0500 Subject: [Rxtx] Re: Mac OS X RXTX java installer In-Reply-To: <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> <247EB61F-5CD1-4132-89A2-FC105B6CF9A5@spacestar.net> Message-ID: Hi, Michael all I have to do is to run some shell script I tried to use your action mechanism and it worked great so I just System.setProperty ("authkit.action","" ) and after that I even don't need to run anything like subject.doAs.... but after few thoughts I choose to use plain Greg's approach, because in that case I don't have to deal with various java's configurations files and therefore to use 2-3 -D parameters in the java command line especially it's useful for java web start (it's so fragile :-( ) thanks for the great job On Mar 20, 2006, at 7:25 AM, Michael Hall wrote: > > On Mar 20, 2006, at 1:20 AM, Dmitry Markman wrote: >> >> Michael Hall (mikehall at spacestar dot net) had a suggestion to >> make implementation of the jaas LoginModule >> based on Greg's AuthKit >> (his modification of the Greg's AuthKit could be found at http:// >> www.spacestar.net/users/mikehall/authkit.dmg) >> but Michael's AuthKitLoginModule does only half a job: >> it does authenticate >> but it can not run any external unix process in privileged mode >> (at least I wasn't able to do so) > > If you got it working directly with Greg's the point is moot. > > But to clarify it anyhow. > The login module does not allow you to do anything anything > privileged on return as was explained by Greg. You need to work > with a separate privileged process using the execPrivileged method > of his API. I assume you did something similar although I haven't > looked at how you are using it yet. > I allowed instead for a action to be performed at the same time you > login/authenticate,this... > System.setProperty("authkit.action","/usr/bin/id"); > just before this... > lc.login(); > To clarify, safely ignored as you are already complete. > > Mike Hall mikehall at spacestar dot net > http://www.spacestar.net/users/mikehall > http://sourceforge.net/projects/macnative > > > Dmitry Markman From dmarkman at mac.com Mon Mar 20 07:44:45 2006 From: dmarkman at mac.com (Dmitry Markman) Date: Mon, 20 Mar 2006 09:44:45 -0500 Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com> Message-ID: it's in the commapi-0-0-1 branch I tested it right now: cvs co -r commapi-0-0-1 rxtx-devel and I got everything On Mar 20, 2006, at 9:25 AM, Trent Jarvi wrote: > On Mon, 20 Mar 2006, Dr. Douglas Lyon wrote: > >> Hi Trent, >> Thanks for the info on the CVS checkout procedure. >> I did that and am still not sure where the installer is. > > Hi Doug > > It does look like it was not cvs committed. There is no rxtx-devel/ > contrib/MacOSX directory in there at the moment. It was mentioned > that it was put under contrib. > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Dmitry Markman From tjarvi at qbang.org Mon Mar 20 07:52:57 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 20 Mar 2006 07:52:57 -0700 (MST) Subject: [Rxtx] Mac OS X RXTX java installer In-Reply-To: References: <07D0DE29-BA32-4CFE-B036-66BC6423D385@buechse.de> <441AE3E0.2030503@willicon.de> <12531986.1142622114996.JavaMail.dmarkman@mac.com> <441B2674.9010409@willicon.de> <13577405.1142634732776.JavaMail.dmarkman@mac.com> <441B4182.8010407@willicon.de> <92CD0D6C-5BE8-426E-A46D-99452059FF49@mac.com> <441BBB2D.8030305@willicon.de> <441C4088.5090905@willicon.de> <64BC1E23-FDDE-4CE6-8863-CFC881CBC224@mac.com>